// PUBLIC STATIC // PRIVATE /// <summary> /// Plays the request coroutine. /// </summary> /// <returns>The request coroutine.</returns> /// <param name="aAnimationMonitorRequestVO">A animation monitor request V.</param> private IEnumerator _playRequestCoroutine(AnimationMonitorRequestVO aAnimationMonitorRequestVO) { //SEND SIGNAL uiAnimationMonitorSignal.Dispatch(new AnimationMonitorEventVO(AnimationMonitorEventType.PRE_START, aAnimationMonitorRequestVO)); //WAIT yield return(new WaitForSeconds(aAnimationMonitorRequestVO.delayBeforeAnimation)); //PLAY THE ANIMATION if (animation[aAnimationMonitorRequestVO.animationClipName] != null) { animation.wrapMode = aAnimationMonitorRequestVO.wrapMode; animation.name = aAnimationMonitorRequestVO.animationClipName; animation.Play(aAnimationMonitorRequestVO.animationClipName); } else { //KEEP THIS Debug.Log("AnimationMonitor: AnimationClip NOT FOUND: !!!!!" + aAnimationMonitorRequestVO.animationClipName + "!!!!"); } //SEND SIGNAL uiAnimationMonitorSignal.Dispatch(new AnimationMonitorEventVO(AnimationMonitorEventType.START, aAnimationMonitorRequestVO)); //SET TIMER TO KNOW WHEN ANIMATION IS COMPLETE StartCoroutine(_onAnimationComplete(aAnimationMonitorRequestVO)); }
// PRIVATE STATIC //-------------------------------------- // Events //-------------------------------------- //-------------------------------------- // Events // (This is a loose term for -- handling incoming messaging) // //-------------------------------------- /// <summary> /// Ons the animation complete. /// </summary> /// <returns>The animation complete.</returns> /// <param name="aAnimationMonitorRequestVO">A animation monitor request V.</param> private IEnumerator _onAnimationComplete(AnimationMonitorRequestVO aAnimationMonitorRequestVO) { //WAIT yield return(new WaitForSeconds(animation[aAnimationMonitorRequestVO.animationClipName].length)); //SEND SIGNAL uiAnimationMonitorSignal.Dispatch(new AnimationMonitorEventVO(AnimationMonitorEventType.COMPLETE, aAnimationMonitorRequestVO)); //THEN TACK ON SOME EXTRA DELAY FOR COSMETIC TWEAKING yield return(new WaitForSeconds(aAnimationMonitorRequestVO.delayAfterAnimation)); //SEND SIGNAL uiAnimationMonitorSignal.Dispatch(new AnimationMonitorEventVO(AnimationMonitorEventType.POST_COMPLETE, aAnimationMonitorRequestVO)); }
/// <summary> /// Plays the request. /// </summary> /// <param name="aAnimationMonitorRequestVO">A animation monitor request V.</param> public void playRequest(AnimationMonitorRequestVO aAnimationMonitorRequestVO) { StartCoroutine(_playRequestCoroutine(aAnimationMonitorRequestVO)); }
// PUBLIC STATIC // PRIVATE // PRIVATE STATIC //-------------------------------------- // Methods //-------------------------------------- /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /// CONSTRUCTOR / DESTRUCTOR /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// ///<summary> /// Constructor ///</summary> public AnimationMonitorEventVO(AnimationMonitorEventType aUIAnimationMonitorEventType, AnimationMonitorRequestVO aanimationMonitorRequestVO) { animationMonitorEventType = aUIAnimationMonitorEventType; animationMonitorRequestVO = aanimationMonitorRequestVO; }
// PUBLIC STATIC // PRIVATE // PRIVATE STATIC //-------------------------------------- // Methods //-------------------------------------- /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// /// CONSTRUCTOR / DESTRUCTOR /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// ///<summary> /// Constructor ///</summary> public AnimationMonitorEventVO (AnimationMonitorEventType aUIAnimationMonitorEventType, AnimationMonitorRequestVO aanimationMonitorRequestVO ) { animationMonitorEventType = aUIAnimationMonitorEventType; animationMonitorRequestVO = aanimationMonitorRequestVO; }
// PRIVATE STATIC //-------------------------------------- // Events //-------------------------------------- //-------------------------------------- // Events // (This is a loose term for -- handling incoming messaging) // //-------------------------------------- /// <summary> /// Ons the animation complete. /// </summary> /// <returns>The animation complete.</returns> /// <param name="aAnimationMonitorRequestVO">A animation monitor request V.</param> private IEnumerator _onAnimationComplete (AnimationMonitorRequestVO aAnimationMonitorRequestVO) { //WAIT yield return new WaitForSeconds (animation[aAnimationMonitorRequestVO.animationClipName].length); //SEND SIGNAL uiAnimationMonitorSignal.Dispatch (new AnimationMonitorEventVO (AnimationMonitorEventType.COMPLETE, aAnimationMonitorRequestVO)); //THEN TACK ON SOME EXTRA DELAY FOR COSMETIC TWEAKING yield return new WaitForSeconds (aAnimationMonitorRequestVO.delayAfterAnimation); //SEND SIGNAL uiAnimationMonitorSignal.Dispatch (new AnimationMonitorEventVO (AnimationMonitorEventType.POST_COMPLETE, aAnimationMonitorRequestVO)); }
// PUBLIC STATIC // PRIVATE /// <summary> /// Plays the request coroutine. /// </summary> /// <returns>The request coroutine.</returns> /// <param name="aAnimationMonitorRequestVO">A animation monitor request V.</param> private IEnumerator _playRequestCoroutine (AnimationMonitorRequestVO aAnimationMonitorRequestVO) { //SEND SIGNAL uiAnimationMonitorSignal.Dispatch (new AnimationMonitorEventVO (AnimationMonitorEventType.PRE_START, aAnimationMonitorRequestVO)); //WAIT yield return new WaitForSeconds(aAnimationMonitorRequestVO.delayBeforeAnimation); //PLAY THE ANIMATION if (animation[aAnimationMonitorRequestVO.animationClipName] != null) { animation.wrapMode = aAnimationMonitorRequestVO.wrapMode; animation.name = aAnimationMonitorRequestVO.animationClipName; animation.Play (aAnimationMonitorRequestVO.animationClipName); } else { //KEEP THIS Debug.Log ("AnimationMonitor: AnimationClip NOT FOUND: !!!!!" + aAnimationMonitorRequestVO.animationClipName + "!!!!"); } //SEND SIGNAL uiAnimationMonitorSignal.Dispatch (new AnimationMonitorEventVO (AnimationMonitorEventType.START, aAnimationMonitorRequestVO)); //SET TIMER TO KNOW WHEN ANIMATION IS COMPLETE StartCoroutine ( _onAnimationComplete (aAnimationMonitorRequestVO)); }
/// <summary> /// Plays the request. /// </summary> /// <param name="aAnimationMonitorRequestVO">A animation monitor request V.</param> public void playRequest (AnimationMonitorRequestVO aAnimationMonitorRequestVO) { StartCoroutine (_playRequestCoroutine (aAnimationMonitorRequestVO)); }