private int m_StartFrameNumber; //the frame when the CC starts, used to check whether animation is playing, //The Animation component will not set Animation.isPlaying = true until next animation tick #endregion "data" #region "unity event handlers" // unity event handlers void Awake() { m_EvtGORootTr = transform.Find(EventGOS); Dbg.Assert(m_EvtGORootTr != null, "CutsceneController.Start: failed to find EventGO root: {0}", EventGOS); Animation anim = m_Anim = GetComponent <Animation>(); Dbg.Assert(anim != null, "CutsceneController.Start: failed to get animation component: {0}", name); m_ToSwapObjPairs = new SwapObjList(); if (anim.GetClipCount() == 0 && anim.clip == null) { Dbg.LogWarn("CutsceneController.Start: No Clip is assigned to Animation yet, disable CutsceneController: {0}", name); enabled = false; } else { if (anim.clip != null) { m_AnimState = m_Anim[anim.clip.name]; } else { for (var ie = anim.GetEnumerator(); ie.MoveNext();) { m_AnimState = (AnimationState)ie.Current; m_Anim.clip = m_AnimState.clip; break; } } } m_Anim.playAutomatically = false; //not allow auto-play, always call StartCC/StopCC instead if (!ResMgr.HasInst) { ResMgr.Create(); } }