void PushDown() { int levelsCleared = 0; for (int i = 0; i < ClearingLevels.Length; i++) { if (ClearingLevels[i]) { for (int y = i - levelsCleared; y < GridY; y++) { for (int x = 0; x < GridX; x++) { for (int z = 0; z < GridZ; z++) { if (y < GridY - 1) { GameState[x, y, z] = GameState[x, y + 1, z]; TileLogic currentTileController = TileLiterals[x, y, z].GetComponent(typeof(TileLogic)) as TileLogic; TileLogic previousTileController = TileLiterals[x, y + 1, z].GetComponent(typeof(TileLogic)) as TileLogic; currentTileController.SetColor(previousTileController.GetColor()); } else { GameState[x, y, z] = false; } } } } levelsCleared += 1; Score += 1; ClearingLevels[i] = false; } } UpdateBoard(); }