FrontCamera.cs 960 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using UnityEngine;
  3. public class FrontCamera : MonoBehaviour
  4. {
  5. public void Awake()
  6. {
  7. if (GameMain.Instance.VRMode)
  8. {
  9. base.gameObject.SetActive(false);
  10. }
  11. else
  12. {
  13. this.main_camera_ = Camera.main;
  14. this.camera_ = base.GetComponent<Camera>();
  15. this.main_camera_tr_ = this.main_camera_.transform;
  16. this.camera_tr_ = this.camera_.transform;
  17. }
  18. }
  19. public void LateUpdate()
  20. {
  21. if (!GameMain.Instance.VRMode)
  22. {
  23. this.camera_tr_.position = this.main_camera_tr_.position;
  24. this.camera_tr_.rotation = this.main_camera_tr_.rotation;
  25. this.camera_tr_.localScale = this.main_camera_tr_.localScale;
  26. this.camera_.fieldOfView = this.main_camera_.fieldOfView;
  27. this.camera_.nearClipPlane = this.main_camera_.nearClipPlane;
  28. this.camera_.farClipPlane = this.main_camera_.farClipPlane;
  29. }
  30. }
  31. private Camera main_camera_;
  32. private Camera camera_;
  33. private Transform main_camera_tr_;
  34. private Transform camera_tr_;
  35. }