using System; using System.Collections.Generic; namespace asim.unity.managers.tilemanager { /// /// Tileset represent a set a tiles /// also keep tracks and manages the tiles position in the index /// public abstract class Tileset where Tile : ITile { public Tile[,] TileData; public Tileset(Tile[,] InitialTileData) { TileData = InitialTileData; } /// /// For inherit to add tiles at certain index /// public abstract void AddTiles(List> rowColTileList, bool replaceExisting); /// /// For inherit to remove certain index tiles /// public abstract void RemoveTiles(List> rowColList); /// /// To remove all tiles /// public virtual void RemoveAll() { if (TileData == null) return; for (int i = 0; i < TileData.GetLength(0); i++) { for (int j = 0; j < TileData.GetLength(1); j++) { Tile tile = TileData[i, j]; if(tile != null) { tile.DestoryTile(true); } } } TileData = null; } } }