Пример #1
0
 public void OnDied()
 {
     OnDiedEvent?.Invoke();
     foreach (var handler in handlers)
     {
         handler.OnDied();
     }
 }
Пример #2
0
    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);
        }
    }