Ejemplo n.º 1
0
        /// <summary>
        /// Starts a new game.
        /// </summary>
        /// <remarks>
        /// Creates an AI player based upon the _aiSetting.
        /// </remarks>
        public static void StartGame()
        {
            if (_theGame != null)
                EndGame();

            //Create the game
            _theGame = new BattleShipsGame();

            //create the players
            switch (_aiSetting) {
                case AIOption.Easy:
                    _ai = new AIEasyPlayer(_theGame);
                    break;
                case AIOption.Medium:
                    _ai = new AIMediumPlayer(_theGame);
                    break;
                case AIOption.Hard:
                    _ai = new AIHardPlayer(_theGame);
                    break;
                default:
                    _ai = new AIMediumPlayer(_theGame);
                    break;
            }

            _human = new Player(_theGame);

            //AddHandler _human.PlayerGrid.Changed, AddressOf GridChanged
            _ai.PlayerGrid.Changed += GridChanged;
            _theGame.AttackCompleted += AttackCompleted;

            AddNewState(GameState.Deploying);
        }
 public AIEasyPlayer(BattleShipsGame controller)
     : base(controller)
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes the <see cref="Battleships.AIHardPlayer"/> class.
 /// </summary>
 /// <param name="game">Game.</param>
 public AIHardPlayer(BattleShipsGame game)
     : base(game)
 {
 }
        public static void LoadGame()
        {
            _theGame = new BattleShipsGame ();
            //load ai setting
            //load player
            _ai.PlayerGrid.Changed += GridChanged;
            _theGame.AttackCompleted += AttackCompleted;

            AddNewState (GameState.Discovering);
        }
Ejemplo n.º 5
0
 public AIMediumPlayer(BattleShipsGame controller)
     : base(controller)
 {
 }
Ejemplo n.º 6
0
 public AIPlayer(BattleShipsGame game) : base(game)
 {
 }
 public AIEasyPlayer(BattleShipsGame controller) : base(controller)
 {
 }
 public AIMediumPlayer(BattleShipsGame controller) : base(controller)
 {
 }