public void Init() { CameraContainer = Camera.main.transform; state = gameObject.AddComponent <FirstPersonCamera>() as BaseCameraState; state.Construct(); }
public void ChangeState(string stateName) { System.Type t = System.Type.GetType(stateName); state.Destruct(); state = gameObject.AddComponent(t) as BaseCameraState; state.Construct(); }
// Initialize public void Init() { CameraContainer = new GameObject("Camera Container").transform; CameraContainer.gameObject.AddComponent <Camera> (); state = gameObject.AddComponent <ThirdPersonCamera> () as BaseCameraState; state.Construct(); }
public void Init() { CameraContainer = new GameObject("Camera Container").transform; CameraContainer.gameObject.AddComponent<Camera>(); CameraContainer.tag = "MainCamera"; // special tag to denote main camera in scene state = gameObject.AddComponent<ThirdPersonCamera>() as BaseCameraState; state.Construct(); }
public void ChangeState(string stateName) { if (state != null) { state.Destuct(); } System.Type type = System.Type.GetType(stateName); state = gameObject.AddComponent(type) as BaseCameraState; state.Construct(); }
public void Init() { if (Camera.main == null) { CameraContainer = new GameObject("Camera Container").transform; cam = CameraContainer.gameObject.AddComponent <Camera> (); CameraContainer.gameObject.AddComponent <AudioListener> (); CameraContainer.tag = "MainCamera"; // Debug.Log ("Init"); } else { Camera.main.gameObject.name = "Camera Container"; cam = Camera.main; CameraContainer = Camera.main.transform; // Debug.Log ("Init"); } state = gameObject.AddComponent <MobaStyleCamera> () as BaseCameraState; state.Construct(); }