public bool IsOver() { bool _isOver = false; //is it the end? if (CurrentActor == Actor.User) { if (EnemyBattleField.Boats.All(b => b.State == BoatState.Dead)) { Result = GameResult.Victory; Stage = GameStage.Finished; EnemyBattleField.RemoveFog(); _isOver = true; } } else // it was enemy's shoot { if (UserBattleField.Boats.All(b => b.State == BoatState.Dead)) { Result = GameResult.Defeat; Stage = GameStage.Finished; EnemyBattleField.RemoveFog(); _isOver = true; } } return(_isOver); }
public Game() { UserBattleField = new UserBattleField(this); EnemyBattleField = new EnemyBattleField(this); Stage = GameStage.BoatsArrange; CurrentActor = Actor.User; Result = GameResult.InPlay; r = new Random(); }