Пример #1
0
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (stateInfo.normalizedTime % 1 >= startDamage && stateInfo.normalizedTime % 1 <= endDamage && !isActive)
        {
            if (debug)
            {
                Debug.Log(animator.name + " attack " + attackName + " enable damage in " + System.Math.Round(stateInfo.normalizedTime % 1, 2));
            }
            isActive = true;
            ActiveDamage(animator, true);
        }
        else if (stateInfo.normalizedTime % 1 > endDamage && isActive)
        {
            if (debug)
            {
                Debug.Log(animator.name + " attack " + attackName + " disable damage in " + System.Math.Round(stateInfo.normalizedTime % 1, 2));
            }
            isActive = false;
            ActiveDamage(animator, false);
        }

        if (stateInfo.normalizedTime % 1 > allowMovementAt && isAttacking)
        {
            isAttacking = false;
            if (mFighter != null)
            {
                mFighter.OnDisableAttack();
            }
        }
    }