Ejemplo n.º 1
0
 public virtual void TakeDamage(float damage)
 {
     if (!isAlive || damage <= 0.0f)
     {
         return;
     }
     if (SupportRange.InSupportRange(gameObject))
     {
         damage *= 0.75f;
     }
     HeroUIScript.Damage(damage * (1.0f - dmgDamp * 0.01f), transform.position + Vector3.up *
                         10.0f);
     currHP -= damage * (1.0f - dmgDamp * 0.01f);
     Attacked?.Invoke();
     if (currHP <= 0.0f)
     {
         currHP  = 0.0f;
         isAlive = false;
         if (!(this is PortalInfo))
         {
             gameObject.SetActive(false);
             if (destroyable)
             {
                 Destroy(gameObject, 1.0f);
             }
         }
         Destroyed?.Invoke();
     }
 }
Ejemplo n.º 2
0
 public bool UseMana(float manaCost)
 {
     if (mana - manaCost < 0.0f)
     {
         return(false);
     }
     mana -= manaCost;
     HeroUIScript.Mana(manaCost, transform);
     return(true);
 }
Ejemplo n.º 3
0
 private void Awake()
 {
     inst = this;
 }