예제 #1
0
 public GameManager(GameType gameSize, int cellSize, Grid grid, PlayerType playerOne, PlayerType playerTwo)
 {
     size       = gameSize;
     refGrid    = grid;
     squareSize = cellSize;
     if (playerOne == PlayerType.AI) //Create the AIs
     {
         player1 = new AI(gameSize);
     }
     if (playerTwo == PlayerType.AI)
     {
         player2 = new AI(gameSize);
     }
     if (size == GameType.Small)
     {
         SmallGrid = new SmallGrid(0, 0, 0, 0, GameType.Small, squareSize, refGrid); //Create a small grid and pass it to the AIS
         if (playerOne == PlayerType.AI)
         {
             player1.AddGrid(SmallGrid);
         }
         if (playerTwo == PlayerType.AI)
         {
             player2.AddGrid(SmallGrid);
         }
     }
     else if (size == GameType.Big)
     {
         BigGrid = new BigGrid(0, 0, GameType.Big, squareSize, refGrid); //Create a big grid and pass it to the AIs
         if (playerOne == PlayerType.AI)
         {
             player1.AddGrid(BigGrid);
         }
         if (playerTwo == PlayerType.AI)
         {
             player2.AddGrid(BigGrid);
         }
     }
     else if (size == GameType.Huge)
     {
         HugeGrid = new HugeGrid(squareSize, refGrid); //Create a huge grid and pass it to the AIs
         if (playerOne == PlayerType.AI)
         {
             player1.AddGrid(HugeGrid);
         }
         if (playerTwo == PlayerType.AI)
         {
             player2.AddGrid(HugeGrid);
         }
     }
     if (playerOne == PlayerType.AI)
     {
         player1.AddManager(this);
     }
     if (playerTwo == PlayerType.AI)
     {
         player2.AddManager(this);
     }
     if (playerOne == PlayerType.AI)
     {
         player1.MakeChoice();
     }
 }
예제 #2
0
 public GameManager(GameType gameSize, int cellSize, Grid grid, PlayerType playerOne, PlayerType playerTwo)
 {
     size       = gameSize;
     refGrid    = grid;
     squareSize = cellSize;
     if (playerOne == PlayerType.AI) //Create the AIs
     {
         player1 = new AI(gameSize);
     }
     if (playerTwo == PlayerType.AI)
     {
         player2 = new AI(gameSize);
     }
     if (size == GameType.Small)
     {
         SmallGrid = new SmallGrid(0, 0, 0, 0, GameType.Small, squareSize, refGrid); //Create a small grid and pass it to the AIS
         if (playerOne == PlayerType.AI)
         {
             player1.AddGrid(SmallGrid);
         }
         if (playerTwo == PlayerType.AI)
         {
             player2.AddGrid(SmallGrid);
         }
     }
     else if (size == GameType.Big)
     {
         BigGrid            = new BigGrid(0, 0, GameType.Big, squareSize, refGrid); //Create a big grid and pass it to the AIs
         BigGridCurrentPosX = 1;                                                    //Set the available small grid
         BigGridCurrentPosY = 1;
         BigGrid.Color(1, 1, Brushes.Blue);                                         //Color the available small gird
         if (playerOne == PlayerType.AI)
         {
             player1.AddGrid(BigGrid);
         }
         if (playerTwo == PlayerType.AI)
         {
             player2.AddGrid(BigGrid);
         }
     }
     else if (size == GameType.Huge)
     {
         HugeGrid            = new HugeGrid(squareSize, refGrid);                                                        //Create a huge grid and pass it to the AIs
         HugeGridCurrentPosX = 1;                                                                                        //Set the available big grid
         HugeGridCurrentPosY = 1;
         BigGridCurrentPosX  = 1;                                                                                        //Set the available small grid
         BigGridCurrentPosY  = 1;
         HugeGrid.Color(HugeGridCurrentPosX, HugeGridCurrentPosY, BigGridCurrentPosX, BigGridCurrentPosY, Brushes.Blue); //Color the available small grid
         if (playerOne == PlayerType.AI)
         {
             player1.AddGrid(HugeGrid);
         }
         if (playerTwo == PlayerType.AI)
         {
             player2.AddGrid(HugeGrid);
         }
     }
     if (playerOne == PlayerType.AI)
     {
         player1.AddManager(this);
     }
     if (playerTwo == PlayerType.AI)
     {
         player2.AddManager(this);
     }
     if (playerOne == PlayerType.AI)
     {
         player1.MakeChoice();
     }
 }