Exemplo n.º 1
0
 public void TakeDamage(Damage d)
 {
     StartCoroutine(DamageFlick(1, 0.03f, 0.03f));
     d.TargetParameters = parameter;
     this.health.hp    -= d.Calculate();
     d.Appear(this.transform.position);
     CheckDeath();
 }
Exemplo n.º 2
0
        public void TakeDamage(Damage damage)
        {
            var healthBar = GameObject.FindObjectOfType <HealthBar>();

            damage.TargetParameters = parameter;

            if (damage.totalDamage < 0)
            {
                Heal(damage.totalDamage);
                damage.Appear(healthBar.gameObject.transform.position, true);
                SoundManager.instance.PlaySound(8);
            }
            else
            {
                health.hp -= damage.Calculate();
                damage.Appear(healthBar.gameObject.transform.position);
                SoundManager.instance.PlaySound(6);
            }
        }