using System; using System.Collections.Generic; namespace asim.unity.managers.tilemanager { public class SimpleTileset : Tileset { public SimpleTileset(SimpleTile[,] InitialTileData) : base(InitialTileData) { } public override void AddTiles(List> rowColTileList,bool replaceExisting) { foreach (Tuple rowColTile in rowColTileList) { int rowIndex = rowColTile.Item1; int colIndex = rowColTile.Item2; SimpleTile tileToAdd = rowColTile.Item3; SimpleTile currentTile = TileData[rowIndex, colIndex]; //Check if theres an existing tile and remove it if (currentTile && replaceExisting) { currentTile.DestoryTile(true); } TileData[rowIndex, colIndex] = tileToAdd; } } public override void RemoveTiles(List> rowColList) { foreach (Tuple rowcol in rowColList) { int rowIndex = rowcol.Item1; int colIndex = rowcol.Item2; SimpleTile currentTile = TileData[rowIndex, colIndex]; //Check if theres an existing tile and remove it if (currentTile) { currentTile.DestoryTile(true); } TileData[rowIndex, colIndex] = currentTile; } } } }