Пример #1
0
 //Defend
 void Defend()
 {
     enemyState = UNITSTATE.DEFEND;
     animator.ShowDefendEffect();
     animator.SetAnimatorTrigger("Defend");
     GlobalAudioPlayer.PlaySFX("DefendHit");
     animator.SetDirection(currentDirection);
 }
Пример #2
0
    //defend an incoming attack
    void Defend(DamageObject d)
    {
        //show defend effect
        animator.ShowDefendEffect();

        //play sfx
        GlobalAudioPlayer.PlaySFXAtPosition(defenceHitSFX, transform.position + Vector3.up);

        //add a small force from the impact
        if (isFacingTarget(d.inflictor))
        {
            animator.AddForce(-hitKnockBackForce);
        }
        else
        {
            animator.AddForce(hitKnockBackForce);
        }
    }