1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System;
- using UnityEngine;
- public class CameraAnimationMgr : BaseMgr<CameraAnimationMgr>
- {
- public void Play(string cameraAnimationName)
- {
- this.ClearCameraAnimationRoot();
- GameObject cameraAnimationRoot = this.GetCameraAnimationRoot();
- this.m_cameraAnimeCtrl = cameraAnimationRoot.GetComponent<CameraAnimationCtrl>();
- this.m_cameraAnimeCtrl.Play(cameraAnimationRoot, cameraAnimationName);
- }
- public void PlayByPath(string animePrefabPath)
- {
- this.ClearCameraAnimationRoot();
- GameObject cameraAnimationRoot = this.GetCameraAnimationRoot();
- this.m_cameraAnimeCtrl = cameraAnimationRoot.GetComponent<CameraAnimationCtrl>();
- 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<GameObject>(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";
- }
|