public void SetupScene(int level, int increment) { if (levels.Count < level) { grid = new GameObject[columns, rows]; levelGenerator = gameObject.AddComponent(typeof(LevelGenerator)) as LevelGenerator; boardHolder = new GameObject("Board").transform; shadowHolder = new GameObject("Shadow").transform; levelGenerator.Initiate(columns, rows); player_position = levelGenerator.BoardSetup(grid, genericTile); levels.Add(grid); } else { grid = levels[level - 1]; Vector3 current_pos = GameObject.FindGameObjectWithTag("Player").transform.position; player_position[0] = (int)current_pos[0] + columns * increment; GameObject.FindGameObjectWithTag("Player").transform.position = new Vector3(player_position[0], current_pos[1], 0); } /*int[] aux_pos = grid[player_position[0], player_position[1] + 1].GetComponent<Tile>().position; * int tileset = grid[player_position[0], player_position[1] + 1].GetComponent<Tile>().tileset; * grid[player_position[0], player_position[1] + 1].GetComponent<Tile>().SetUpTile(TYPE.floor, CONTAINED.item, 2, tileset, aux_pos); * grid[player_position[0], player_position[1] + 1].GetComponent<Tile>().StartFire(); * * * int[] aux_pos_2 = grid[player_position[0], player_position[1] - 1].GetComponent<Tile>().position; * int tileset_2 = grid[player_position[0], player_position[1] - 1].GetComponent<Tile>().tileset; * grid[player_position[0], player_position[1] - 1].GetComponent<Tile>().SetUpTile(TYPE.floor, CONTAINED.item, 0, tileset_2, aux_pos_2); * * * int[] aux_pos_3 = grid[player_position[0] - 1, player_position[1]].GetComponent<Tile>().position; * int tileset_3 = grid[player_position[0] - 1, player_position[1]].GetComponent<Tile>().tileset; * grid[player_position[0] - 1, player_position[1]].GetComponent<Tile>().SetUpTile(TYPE.floor, CONTAINED.item, 1, tileset_3, aux_pos_3); */ gridPositions.Clear(); for (int x = 1; x < columns - 1; x++) { for (int y = 1; y < rows - 1; y++) { gridPositions.Add(new Vector3(x, y, 0f)); } } }