using System; using UnityEngine; public class CameraAnimationMgr : BaseMgr { public void Play(string cameraAnimationName) { this.ClearCameraAnimationRoot(); GameObject cameraAnimationRoot = this.GetCameraAnimationRoot(); this.m_cameraAnimeCtrl = cameraAnimationRoot.GetComponent(); this.m_cameraAnimeCtrl.Play(cameraAnimationRoot, cameraAnimationName); } public void PlayByPath(string animePrefabPath) { this.ClearCameraAnimationRoot(); GameObject cameraAnimationRoot = this.GetCameraAnimationRoot(); this.m_cameraAnimeCtrl = cameraAnimationRoot.GetComponent(); this.m_cameraAnimeCtrl.PlayByPath(cameraAnimationRoot, animePrefabPath); } private void ClearCameraAnimationRoot() { GameObject gameObject = GameObject.Find("CameraAnimationRoot"); if (gameObject != null) { UnityEngine.Object.Destroy(gameObject); } } private GameObject GetCameraAnimationRoot() { GameObject original = Resources.Load("Debug/CameraAnimation/Prefab/CameraAnimationRoot") as GameObject; GameObject gameObject = UnityEngine.Object.Instantiate(original); gameObject.name = "CameraAnimationRoot"; return gameObject; } public void Pause() { this.m_cameraAnimeCtrl.Pause(); } public void Resume() { this.m_cameraAnimeCtrl.Resume(); } public void Stop() { this.m_cameraAnimeCtrl.Stop(); } private CameraAnimationCtrl m_cameraAnimeCtrl; private const string CAMERA_ANIMATION_ROOT_NAME = "CameraAnimationRoot"; private const string CAMERA_ANIMATION_PREFAB_PATH = "Debug/CameraAnimation/Prefab/CameraAnimationRoot"; }