Example #1
0
 public void ApplyDamage(int damage)
 {
     HP -= damage;
     if (HP < 0)
     {
         isDead = true;
     }
     HPChanged?.Invoke(this, new TowerHPChangeEventArgs(HP));
 }
Example #2
0
        public void Heal(int heal)
        {
            HP += heal;
            if (HP > Max_HP)
            {
                HP = Max_HP;
            }

            HPChanged?.Invoke(this, new TowerHPChangeEventArgs(HP));
        }
Example #3
0
 public virtual void TakeDamage(int damage)
 {
     hp = Mathf.Clamp(hp - damage, 0, MaxHP);
     if (hp > 0)
     {
         HPChanged?.Invoke(hp);
     }
     else
     {
         Die?.Invoke();
     }
 }
Example #4
0
 public void ChangeHP(float hP)
 {
     HPChanged?.Invoke(hP);
 }