Beispiel #1
0
 public void TakeDamage(int dammage, int KB)
 {
     health       -= dammage;
     player.health = health;
     if (health <= 0)
     {
         //joue l'animation de mort ou qqchose
         gameObject.tag = "dead";
         enemy_couroutine script = HitFrom.GetComponent <enemy_couroutine>();
         script.SetTarget(null);
         animator.SetBool("Dead", true);
         death = Time.time + 4;
     }
     else
     {
         this.gameObject.GetComponent <Rigidbody>().AddForce(0, (KB - stability) / 2, stability - KB, ForceMode.Impulse);
     }
 }
Beispiel #2
0
        public void TakeDamage(int dammage, int KB)
        {
            float TrueDamage = dammage - player.armorPower < 0 ? 1 : dammage - player.armorPower;

            player.health -= (TrueDamage);
            if (player.health <= 0)
            {
                gameObject.tag = "dead";
                if (HitFrom != null)
                {
                    enemy_couroutine script = HitFrom.GetComponent <enemy_couroutine>();
                    script.SetTarget(null);
                }
                animator.SetTrigger("Dead");
                death = Time.time + 3;
            }
            else
            {
                this.gameObject.GetComponent <Rigidbody>().AddForce(0, (KB - stability) / 2, stability - KB, ForceMode.Impulse);
            }
        }