Esempio n. 1
0
 // Do Punch
 private void Punch()
 {
     if (_punchIteration == 0 && _animator.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
     {
         // Play first motion from motion list
         _animator.Play(_punchMotion[0, 0]);
         _opponentController.DealAttack(_punchMotion[_punchIteration, 1]);
         _punchDelay = _animator.GetCurrentAnimatorStateInfo(0).length;
     }
     else if (_punchDelay > 0)
     {
         if (_animator.GetCurrentAnimatorStateInfo(0).IsName(_punchMotion[_punchIteration, 0]))
         {
             if (_punchIteration < _punchMotion.GetLength(0) - 1)
             {
                 _punchIteration++;
                 _animator.SetInteger("punch", _punchIteration);
                 _opponentController.DealAttack(_punchMotion[_punchIteration, 1]);
                 _punchDelay = _animator.GetCurrentAnimatorStateInfo(0).length;
             }
         }
     }
 }