private void Update()
 {
     if (MyGameController.gameState == MyGameState.Menu)
     {
         animationState = MyAnimationState.Idle;
     }
     else if (MyGameController.gameState == MyGameState.Playing)
     {
         animationState = MyAnimationState.Run;
         if (m_RunnerMove.nowOffsetIndex < m_RunnerMove.targetOffsetIndex)
         {
             animationState = MyAnimationState.TurnRight;
         }
         else if (m_RunnerMove.nowOffsetIndex > m_RunnerMove.targetOffsetIndex)
         {
             animationState = MyAnimationState.TurnRight;
         }
         else if (m_RunnerMove.isJump)
         {
             animationState = MyAnimationState.Jump;
         }
         else if (m_RunnerMove.isSliding)
         {
             animationState = MyAnimationState.Slide;
         }
     }
     if (MyGameController.gameState == MyGameState.End)
     {
         animationState = MyAnimationState.Death;
     }
     if (animationState == MyAnimationState.Run)
     {
         if (!footStepMusic.isPlaying)
         {
             footStepMusic.Play();
         }
     }
     else
     {
         if (footStepMusic.isPlaying)
         {
             footStepMusic.Stop();
         }
     }
 }
Exemplo n.º 2
0
        public bool InBlockingAnimation()
        {
            MyAnimationState animState = GetAnimationState();

            switch (animState)
            {
            case MyAnimationState.Attack:
                return(true);

            case MyAnimationState.Dead:
                return(true);

            case MyAnimationState.Hit:
                return(true);

            default:
                return(false);
            }
        }