Exemple #1
0
        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);
        }
Exemple #2
0
        public Game()
        {
            UserBattleField  = new UserBattleField(this);
            EnemyBattleField = new EnemyBattleField(this);

            Stage        = GameStage.BoatsArrange;
            CurrentActor = Actor.User;
            Result       = GameResult.InPlay;

            r = new Random();
        }