public void SetHealth(float h) { currentHealth = h; if (isAlive) { if (h < Mathf.Epsilon) { Kill(); return; } } else { if (h > Mathf.Epsilon) { isDestroyed = false; if (OnResurrect != null) { OnResurrect(this); } m_OnResurrected.Invoke(); } } if (OnHealthChanged != null) { OnHealthChanged(this); } }
public void Destroy() { if (OnDestroyed != null) { OnDestroyed(this); } m_OnDestroyed.Invoke(); }
public void Destroy() { isDestroyed = true; Kill(); if (OnDestroyed != null) { OnDestroyed(this); } m_OnDestroyed.Invoke(); }
void Die() { if (OnDeath != null) { OnDeath(this); } m_OnDeath.Invoke(); if (deactivateOnDeath) { gameObject.SetActive(false); } }