/// <summary>Removes the current grid.</summary> public void RemoveGrid() { currentGridFile = null; if (grid != null && grid.Count > 0) { foreach (EditorList list in grid) { if (list != null) { foreach (EditorTile space in list.list) { if (space != null) { SimpleObjectPool.Despawn(space.gridButton); SimpleObjectPool.Despawn(space.gameObject); } } } } grid.Clear(); } foreach (TeleporterColor color in teleportTiles.Keys) { teleportTiles[color].Clear(); } removedTileButtons.Clear(); enemySpawns.Clear(); player = null; }
/// <summary>Removes tile from the grid.</summary> /// <param name="list">The editor list the tile is contained in.</param> /// <param name="tile">The tile to be removed.</param> private void RemoveTile(EditorList list, EditorTile tile) { list.list.Remove(tile); tile.RemoveGridObject(); SimpleObjectPool.Despawn(tile.gameObject); foreach (List <EditorTile> teleporters in teleportTiles.Values) { if (teleporters.Contains(tile)) { teleporters.Remove(tile); break; } } }