private void onWhenSpacehipDie(TextAsSprite i_ScoreAsText) { SettingsManager.AddPlayerScore(i_ScoreAsText); if (SpaceShips.Where(spaceShip => spaceShip.Value.Enabled).Count() == 0) { if (NotifiyGameOver != null) { NotifiyGameOver(); } } }
private void setNumberOfPlayers() { int i = SpaceShips.Where(spaceShip => spaceShip.Value.Enabled).Count(); if (PlayersCount > SpaceShips.Where(spaceShip => spaceShip.Value.Enabled).Count()) { SpaceShips["SpaceShip2"].Enabled = SpaceShips["SpaceShip2"].Visible = true; SpaceShips["SpaceShip2"].WhenIDie += onWhenSpacehipDie; SpaceShips["SpaceShip2"].Add(); } else { SpaceShips["SpaceShip2"].Enabled = SpaceShips["SpaceShip2"].Visible = false; SpaceShips["SpaceShip2"].WhenIDie -= onWhenSpacehipDie; SpaceShips["SpaceShip2"].Remove(); } }