public pentomino getNewPentomino() { pentomino p = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, -1 }, { 0, -2 } }, tileValueLower, tileValueUpper); p = PentominoController.selectRandomPentomino(); currentPentomino = p; return(p); }
bool mouseInGrid() { gridTile currentTile = GameController.getTileAt(xPos, yPos); currentPentomino = GameController.parsePentomino(); int[,] currentPentominoShape = currentPentomino.shape; //TODO: Currently loops over and replaces all tiles - would be more efficient if it would work with only those not empty if (lastTile != currentTile) { for (int i = 0; i < 15; i++) { for (int j = 0; j < 15; j++) { gridTile TileToEmpty = GameController.getTileAt(i, j); if (TileToEmpty.empty) { GameObject GOtoEmpty = GameController.getTileGO(TileToEmpty); GOtoEmpty.GetComponentInChildren <Canvas> ().enabled = false; tileObjectController ControllerToEmpty = GOtoEmpty.GetComponent <tileObjectController> (); ControllerToEmpty.MousedOut(); } } } } for (int i = 0; i < currentPentominoShape.GetLength(0); i++) { gridTile tmpTile = GameController.getTileAt(xPos + currentPentominoShape [i, 0], yPos + currentPentominoShape [i, 1]); if (inverted == 3) { tmpTile = GameController.getTileAt(xPos + (currentPentominoShape [i, 1] * -1), yPos + currentPentominoShape [i, 0]); } if (inverted == 2) { tmpTile = GameController.getTileAt(xPos + (currentPentominoShape [i, 0] * -1), yPos + (currentPentominoShape [i, 1] * -1)); } if (inverted == 1) { tmpTile = GameController.getTileAt(xPos + currentPentominoShape [i, 1], yPos + (currentPentominoShape [i, 0] * -1)); } if (tmpTile == null || tmpTile.empty == false) { return(false); } } for (int i = 0; i < currentPentominoShape.GetLength(0); i++) { gridTile tmpTile = GameController.getTileAt(xPos + currentPentominoShape [i, 0], yPos + currentPentominoShape [i, 1]); if (inverted == 3) { tmpTile = GameController.getTileAt(xPos + (currentPentominoShape [i, 1] * -1), yPos + currentPentominoShape [i, 0]); } if (inverted == 2) { tmpTile = GameController.getTileAt(xPos + (currentPentominoShape [i, 0] * -1), yPos + (currentPentominoShape [i, 1] * -1)); } if (inverted == 1) { tmpTile = GameController.getTileAt(xPos + currentPentominoShape [i, 1], yPos + (currentPentominoShape [i, 0] * -1)); } GameObject tmpGO = GameController.getTileGO(tmpTile); tmpGO.GetComponentInChildren <Canvas> ().enabled = true; tileObjectController tmpController = tmpGO.GetComponent <tileObjectController> (); tmpController.MousedOver(); //tmpController.updateTileValue ("1"); tmpController.updateTileValue(currentPentomino.values[i].ToString()); } return(true); }
public void BuildPentominoDict() { pentomino p1 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, -1 }, { 0, -2 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [0] = p1; pentomino p2 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 0, -1 }, { -1, 0 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [1] = p2; pentomino p3 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { -1, 1 }, { 0, -1 }, { 1, 0 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [2] = p3; pentomino p4 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, -1 }, { 1, -1 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [3] = p4; pentomino p5 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 0, -1 }, { -1, -1 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [4] = p5; pentomino p6 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { -1, 1 }, { -1, 0 }, { 0, -1 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [5] = p6; pentomino p7 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 1, 0 }, { 0, -1 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [6] = p7; pentomino p8 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 0, 2 }, { -1, 0 }, { -1, -1 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [7] = p8; pentomino p9 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 0, 2 }, { 1, 0 }, { 1, -1 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [8] = p9; pentomino p10 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { -1, 1 }, { 1, 1 }, { 0, -1 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [9] = p10; pentomino p11 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 1, 0 }, { -1, 0 }, { -1, 1 }, { 1, 1 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [10] = p11; pentomino p12 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 0, 2 }, { -1, 0 }, { -2, 0 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [11] = p12; pentomino p13 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, -1 }, { -1, -1 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [12] = p13; pentomino p14 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [13] = p14; pentomino p15 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 }, { 0, -2 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [14] = p15; pentomino p16 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 1, 0 }, { 0, -1 }, { 0, -2 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [15] = p16; pentomino p17 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 0, 2 }, { -1, 0 }, { -2, 0 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [16] = p17; pentomino p18 = new pentomino(5, 1, new int[5, 2] { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 0, -1 }, { -1, -1 } }, GameController.tileValueLower, GameController.tileValueUpper); allPentominos [17] = p18; }