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); }
void Eliminate() { EliminatedEventArgs e = new EliminatedEventArgs() { Amount = 0, AllEliminated = false }; for(int j = scene.GetLength(1) - 1; j >= 0; j--) { if(AllOccupied(j)) { painter.DrawLine(j, painter.EliminatingColor); for(int i = 0; i < scene.GetLength(0); i++) DropOneColumn(i, j); e.Amount++; j++; } } if(AllEmpty(scene.GetLength(1) - 1)) e.AllEliminated = true; if(e.Amount != 0) Eliminated(e); }
void Game_OnUnitDeath(object sender, EliminatedEventArgs e) => InternalHandler(ef => ef.ProcessUnitDeath(sender, e));
void Game_OnPlayerEliminated(object sender, EliminatedEventArgs e) => InternalHandler(ef => ef.ProcessPlayerEliminated(sender, e));
void Unit_OnDeath(object sender, EliminatedEventArgs e) { _unit.OnDeath -= Unit_OnDeath; OnUnitDeath?.Invoke(sender, e); }
public virtual void ProcessUnitDeath(object sender, EliminatedEventArgs e) { }
public virtual void ProcessPlayerEliminated(object sender, EliminatedEventArgs e) { }