public void OnDied() { OnDiedEvent?.Invoke(); foreach (var handler in handlers) { handler.OnDied(); } }
public void TakeDamage(float _damage) { currentHealth -= _damage; if (!IsServer) { Debug.Log("Not called by SERVER!"); //Should enforce this somewhere } if (currentHealth <= 0) { livesLeft--; OnDiedEvent?.Invoke(); //For Server OnDiedClientRpc(OwnerClientId); } }