/***** PUBLIC STATIC METHOD *****/ public static Tile2[,] CreateBoard(int cols, int rows) { //Debug.Log("Creating board " + cols + " " + rows); var board = new Tile2[cols, rows]; // x, y for (int i = 0; i < cols; i++) { for (int j = 0; j < rows; j++) { board[i, j] = new Tile2(i, j); } } /* * for (int x = 0; x < cols; x++) { * for (int y = 0; y < rows; y++) { * var tile = (Tile2)board.GetValue2(x, y); * tile.AddAdjacentTile(Location.TopLeft, (Tile2)board.GetValue2(x-1, y-1)); * tile.AddAdjacentTile(Location.Top, (Tile2)board.GetValue2(x, y-1)); * tile.AddAdjacentTile(Location.TopRight, (Tile2)board.GetValue2(x+1, y-1)); * tile.AddAdjacentTile(Location.Left, (Tile2)board.GetValue2(x-1, y)); * tile.AddAdjacentTile(Location.Right, (Tile2)board.GetValue2(x+1, y)); * tile.AddAdjacentTile(Location.BottomLeft, (Tile2)board.GetValue2(x-1, y+1)); * tile.AddAdjacentTile(Location.Bottom, (Tile2)board.GetValue2(x, y+1)); * tile.AddAdjacentTile(Location.BottomRight, (Tile2)board.GetValue2(x+1, y+1)); * } * } */ return(board); }
// Once the game needs to restart to its normal values in order to play again void resetGame() { Tile1.SetActive(false); Tile2.SetActive(false); Tile3.SetActive(false); pickTileText.SetActive(false); moneyAddFlag = true; }
void AddAdjacentTile(Location loc, Tile2 tile) { if (tile != null) { adjacentFlags |= loc; adjacent.Add(loc, tile); } }
public bool moneyAddFlag = true; // Flag to disable Play 100 from doing anything // Start is called before the first frame update void Start() { // Restart the amount of credits to zero at the beginning of the game creditAmount = 0; //Restart the playButton back to show up playButton.SetActive(true); // Don't show pick a tile text yet pickTileText.SetActive(false); // Let all the tiles be unactive until we hit play Tile1.SetActive(false); Tile2.SetActive(false); Tile3.SetActive(false); }
/* * Button -> Play100 * GameObj -> addCreditsObj * Function -> This can only be played when Credits has 100 or more. When pressed, Credits will be reduced * by 100 and play beings. */ public void onClickPlay() { // This can only be played when credits have 100 or more if (creditAmount >= 100 && moneyAddFlag) { // When pressed, credits will be reduced by 100 creditAmount -= 100; // Display the current amount of credits creditText.text = "Credits: " + creditAmount.ToString(); // TODO: Start playing the game Tile1.SetActive(true); Tile2.SetActive(true); Tile3.SetActive(true); tile1Value = 0; tile2Value = 0; Tile3Value = 0; assignValues(); } }
public Province2(Tile2 tile, Nation2 nation) { Tiles = new[] { tile }; tileGroup = nation; }