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);
    }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 void Game_OnUnitDeath(object sender, EliminatedEventArgs e) => InternalHandler(ef => ef.ProcessUnitDeath(sender, e));
Beispiel #4
0
 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);
 }
Beispiel #6
0
 public virtual void ProcessUnitDeath(object sender, EliminatedEventArgs e)
 {
 }
Beispiel #7
0
 public virtual void ProcessPlayerEliminated(object sender, EliminatedEventArgs e)
 {
 }