예제 #1
0
    public void Damage(int dmg, DamagerInterface Damager = null)
    {
        if (!death)
        {
            Health -= dmg;

            if (!followingPlayer)
            {
                followingPlayer = true;
            }

            if (Health <= 0)
            {
                death = true;
                gm.KillEnemy();
                zombieAnimator.SetFloat("Death", Random.Range(0, 2));
                zombieAnimator.SetTrigger("Kill");
                Destroy(myAgent);
            }
            else if (!stunt)
            {
                SetZombieMovement(false);
                stunt = true;
                zombieAnimator.SetTrigger("Stunt");
            }
        }
    }
예제 #2
0
    public void FenceDamage(int dmg, DamagerInterface Damager)
    {
        currentFenceHP -= dmg;

        if (currentFenceHP <= 0)
        {
            normalFence.SetActive(false);
            brokenFence.SetActive(true);
            myNavMesh.enabled    = false;
            myCollider.isTrigger = true;
            myCollider.enabled   = false;
            if (Damager != null)
            {
                Damager.StopAttacking();
            }
            Invoke("restoreCollider", 10);
        }
    }
예제 #3
0
    private bool death = false; //Tecnicamente un zombie ya está muerto de base pero bueno, ya me entendéis

    public void Damage(int dmg, DamagerInterface Damager = null)
    {
        if (!death)
        {
            Health -= dmg;

            if (!followingPlayer)
            {
                followingPlayer = true;
            }

            if (Health <= 0)
            {
                death = true;
                //gm.KillEnemy();
                //zombieAnimator.SetFloat("Death", Random.Range(0, 2));
                //zombieAnimator.SetTrigger("Kill");
                Destroy(this.gameObject);
                Destroy(myAgent);
            }
        }
    }
예제 #4
0
 public void Damage(int dmg, DamagerInterface Damager)
 {
     PlayerManager.Instance.DamagePlayer(dmg);
 }
예제 #5
0
 public void Damage(int dmg, DamagerInterface damager)
 {
     FenceDamage(dmg, damager);
 }