| | 1 | | using System.Data.Common; |
| | 2 | | using DCL.Camera; |
| | 3 | | using DCL.Helpers; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace DCL |
| | 7 | | { |
| | 8 | | public class InitialSceneReferences : MonoBehaviour |
| | 9 | | { |
| | 10 | | public class Data |
| | 11 | | { |
| | 12 | | public MouseCatcher mouseCatcher; |
| | 13 | | public GameObject groundVisual; |
| | 14 | | public GameObject cameraParent; |
| | 15 | | public InputController inputController; |
| | 16 | | public GameObject cursorCanvas; |
| | 17 | | public BuilderInWorldBridge builderInWorldBridge; |
| | 18 | | public PlayerAvatarController playerAvatarController; |
| | 19 | | public CameraController cameraController; |
| | 20 | | public UnityEngine.Camera mainCamera; |
| | 21 | | public GameObject bridgeGameObject; |
| | 22 | |
|
| 0 | 23 | | public Data () { } |
| | 24 | |
|
| 102 | 25 | | public Data(InitialSceneReferences component) |
| | 26 | | { |
| 102 | 27 | | cameraController = component.cameraControllerReference; |
| 102 | 28 | | cameraParent = component.cameraParentReference; |
| 102 | 29 | | cursorCanvas = component.cursorCanvasReference; |
| 102 | 30 | | groundVisual = component.groundVisualReference; |
| 102 | 31 | | inputController = component.inputControllerReference; |
| 102 | 32 | | mainCamera = component.mainCameraReference; |
| 102 | 33 | | builderInWorldBridge = component.builderInWorldBridgeReference; |
| 102 | 34 | | playerAvatarController = component.playerAvatarControllerReference; |
| 102 | 35 | | mouseCatcher = component.mouseCatcherReference; |
| 102 | 36 | | } |
| | 37 | | } |
| | 38 | |
|
| | 39 | | public Data data; |
| | 40 | |
|
| | 41 | | [SerializeField] private MouseCatcher mouseCatcherReference; |
| | 42 | | [SerializeField] private GameObject groundVisualReference; |
| | 43 | | [SerializeField] private GameObject cameraParentReference; |
| | 44 | | [SerializeField] private InputController inputControllerReference; |
| | 45 | | [SerializeField] private GameObject cursorCanvasReference; |
| | 46 | | [SerializeField] private BuilderInWorldBridge builderInWorldBridgeReference; |
| | 47 | | [SerializeField] private PlayerAvatarController playerAvatarControllerReference; |
| | 48 | | [SerializeField] private CameraController cameraControllerReference; |
| | 49 | | [SerializeField] private UnityEngine.Camera mainCameraReference; |
| | 50 | | [SerializeField] private GameObject bridgeGameObjectReference; |
| | 51 | |
|
| 0 | 52 | | public GameObject groundVisual => data.groundVisual; |
| 0 | 53 | | public GameObject cameraParent => data.cameraParent; |
| 0 | 54 | | public GameObject cursorCanvas => data.cursorCanvas; |
| 0 | 55 | | public MouseCatcher mouseCatcher => data.mouseCatcher; |
| 0 | 56 | | public InputController inputController => data.inputController; |
| 0 | 57 | | public BuilderInWorldBridge builderInWorldBridge => data.builderInWorldBridge; |
| 0 | 58 | | public PlayerAvatarController playerAvatarController => data.playerAvatarController; |
| 0 | 59 | | public CameraController cameraController => data.cameraController; |
| 0 | 60 | | public UnityEngine.Camera mainCamera { get { return mainCameraReference; } } |
| 0 | 61 | | public GameObject bridgeGameObject { get { return bridgeGameObjectReference; } } |
| | 62 | |
|
| 0 | 63 | | public static InitialSceneReferences i { get; private set; } |
| | 64 | |
|
| | 65 | | void Awake() |
| | 66 | | { |
| 102 | 67 | | if (i != null) |
| | 68 | | { |
| 0 | 69 | | Utils.SafeDestroy(this); |
| 0 | 70 | | return; |
| | 71 | | } |
| | 72 | |
|
| 102 | 73 | | i = this; |
| 102 | 74 | | data = new Data(this); |
| 102 | 75 | | } |
| | 76 | |
|
| 202 | 77 | | void OnDestroy() { i = null; } |
| | 78 | | } |
| | 79 | | } |