Exemplo n.º 1
0
 /// <summary>
 /// When the ball dies by an attack, it destroyes the owner as long as an owner exists. If the ball
 /// is deactivated or destroyed, this method is not called. You must use the attack system for
 /// this component to work.
 /// </summary>
 private void OnDeath(GameObject killer)
 {
     if (Owner != null)
     {
         IDeath death = Owner.GetComponent <IDeath>();
         if (death != null)
         {
             death.Die(killer);
         }
     }
 }
Exemplo n.º 2
0
    public void TakeDamage(float value)
    {
        _currentHealth -= value;
        OnHealthChangedAction?.Invoke(_currentHealth, maxHealth);

        if (!(_currentHealth <= 1))
        {
            return;
        }
        _death.Die();
        IsDead = true;
    }