/* * Match Avatar Tile * * @param tiles */ public void MatchAvatarTile(GameObject tile) { GameTileType tempTileType = tile.GetComponent <GameTileBase>().GetGameTileType(); for (int i = 0; i < gameBoard.width; i++) { for (int j = 0; j < gameBoard.height; j++) { if (gameBoard.allGameTiles[i, j]) { GameTileBase tempTile = gameBoard.allGameTiles[i, j].GetComponent <GameTileBase>(); // Match all tiles if (tile.GetComponent <GameTileBase>().GetTileType() == TileType.Avatar) { tempTile.SetHasMatched(true); } // Finds tile of same type else if (gameBoard.allGameTiles[i, j].GetComponent <GameTileBase>().GetGameTileType() == tempTileType) { ChainSpecialMatches(tempTile.gameObject); tempTile.SetHasMatched(true); } } } } }
/* * Makes Avatar tile */ public void MakeAvatarTileCheck() { if (gameBoard.currentTile) { // Turn current tile into Avatar if (gameBoard.currentTile.GetHasMatched() && gameBoard.currentTile.GetTileType() == TileType.Normal) { gameBoard.currentTile.SetHasMatched(false); currentMatches.Remove(gameBoard.currentTile.gameObject); gameBoard.currentTile.GenerateAvatarTile(); } // Turn other tile into Avatar else if (gameBoard.currentTile.GetOtherTile()) { if (gameBoard.currentTile.GetOtherTile().GetComponent <GameTileBase>()) { GameTileBase otherTile = gameBoard.currentTile.GetOtherTile().GetComponent <GameTileBase>(); if (otherTile.GetHasMatched() && otherTile.GetTileType() == TileType.Normal) { otherTile.SetHasMatched(false); otherTile.GenerateAvatarTile(); } } } } }
/* * Makes char tile * */ public void MakeCharTileCheck() { if (gameBoard.currentTile) { // Turn current tile into Char if (gameBoard.currentTile.GetHasMatched() && gameBoard.currentTile.GetTileType() == TileType.Normal) { gameBoard.currentTile.SetHasMatched(false); currentMatches.Remove(gameBoard.currentTile.gameObject); if (gameBoard.currentTile.swipeDirection == SwipeDirection.Left || gameBoard.currentTile.swipeDirection == SwipeDirection.Right) { gameBoard.currentTile.GenerateCharTile(true); } else { gameBoard.currentTile.GenerateCharTile(false); } } // Turn other tile into Char else if (gameBoard.currentTile.GetOtherTile()) { if (gameBoard.currentTile.GetOtherTile().GetComponent <GameTileBase>()) { GameTileBase otherTile = gameBoard.currentTile.GetOtherTile().GetComponent <GameTileBase>(); if (otherTile.GetHasMatched() && otherTile.GetTileType() == TileType.Normal) { otherTile.SetHasMatched(false); currentMatches.Remove(gameBoard.currentTile.gameObject); if (gameBoard.currentTile.swipeDirection == SwipeDirection.Left || gameBoard.currentTile.swipeDirection == SwipeDirection.Right) { gameBoard.currentTile.GenerateCharTile(true); } else { gameBoard.currentTile.GenerateCharTile(false); } } } } } }