void Sector_OnUnitDeath(object sender, EliminatedEventArgs e) { if (!ProcessEvents) return; OnUnitDeath?.Invoke(sender, e); Player owner = ((Unit)sender).Owner; if (owner.IsEliminated) PlayerEliminated(owner, e.Eliminator); }
public void UnitDeath(Unit unit) { if (unit.health <= 0) { Destroy(gameObject); OnUnitDeath?.Invoke(this, new OnUnitDeathEventArgs { deadUnit = unit }); } }
/// <summary> /// Вызывает смерть персонажа. /// </summary> public void Die() { OnUnitDeath?.Invoke(this, new UnitEventArgs()); }
void Unit_OnDeath(object sender, EliminatedEventArgs e) { _unit.OnDeath -= Unit_OnDeath; OnUnitDeath?.Invoke(sender, e); }