DebugCameraServiceImpl.cs 803 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using SRF;
  3. using SRF.Service;
  4. using UnityEngine;
  5. namespace SRDebugger.Services.Implementation
  6. {
  7. [Service(typeof(IDebugCameraService))]
  8. public class DebugCameraServiceImpl : IDebugCameraService
  9. {
  10. public DebugCameraServiceImpl()
  11. {
  12. if (Settings.Instance.UseDebugCamera)
  13. {
  14. this._debugCamera = new GameObject("SRDebugCamera").AddComponent<Camera>();
  15. this._debugCamera.cullingMask = 1 << Settings.Instance.DebugLayer;
  16. this._debugCamera.depth = Settings.Instance.DebugCameraDepth;
  17. this._debugCamera.clearFlags = CameraClearFlags.Depth;
  18. this._debugCamera.transform.SetParent(Hierarchy.Get("SRDebugger"));
  19. }
  20. }
  21. public Camera Camera
  22. {
  23. get
  24. {
  25. return this._debugCamera;
  26. }
  27. }
  28. private Camera _debugCamera;
  29. }
  30. }