void PTile(CustomTile _copy) { Tilemap toPlace = null; Tilemap toRemove = null; DictionaryType _type = DictionaryType.Walls; switch (_copy.Type) { case TileType.Wall: toPlace = WallGen.GetTilemap(); toRemove = DungeonUtility.GetTilemap(); _type = DictionaryType.Walls; break; case TileType.Floor: toPlace = DungeonUtility.GetTilemap(); toRemove = DungeonUtility.GetTilemap(); _type = DictionaryType.Floor; break; case TileType.Path: toPlace = DungeonUtility.GetTilemap(); toRemove = DungeonUtility.GetTilemap(); _type = DictionaryType.Floor; break; } int id = 0; for (int a = 0; a < TileManager.GetTileHolder(_copy.Type).Tiles.Count; ++a) { if (TileManager.GetTileHolder(_copy.Type).Tiles[a].ID == _copy.ID) { _copy = TileManager.GetTileHolder(_copy.Type).Tiles[a]; id = TileManager.GetTileHolder(_copy.Type).Tiles[a].ID; } } TileManager.PlaceTile(m_placePos, m_index, toRemove, toPlace, _copy, _type); ApplySpriteVariation(_copy, toPlace, m_placePos); Instantiate(m_audioPlaceSource); if (!m_manager.Creative && BackPack.GetStorageTypeCount(_copy) > 0) { BackPack.RemoveItem(_copy.Item); if (BackPack.GetNewItem(_copy) != null) { _copy.Item = Instantiate(BackPack.GetNewItem(_copy)); } } DataToSave tempData = new DataToSave { Position = new Vector2Int(m_placePos.x, m_placePos.y), ID = id }; m_fileManager.Input(tempData); }
void RemoveDeadTiles(int _index) { if (m_tilesAround[_index].Health <= 0) { DataToSave tempData = new DataToSave { Position = new Vector2Int(m_tilesAround[_index].Pos.x, m_tilesAround[_index].Pos.y), ID = m_tilesAround[_index].ID, IsNull = true, IsPlacedTile = false }; if (TileManager.GetTileDictionaryWalls().ContainsKey(m_tilesAround[_index].Pos)) { if (WallGen.GetTilemap().GetTile(m_tilesAround[_index].Pos) != null) { if (TileManager.GetTileDictionaryFloor().ContainsKey(m_tilesAround[_index].Pos)) { TileManager.PlaceTile(m_tilesAround[_index].Pos, 0, WallGen.GetTilemap(), DungeonUtility.GetTilemap(), TileManager.GetTileDictionaryFloor()[m_tilesAround[_index].Pos].CustomTile, DictionaryType.Floor); PlayBreakingEffect(_index); AddToStorage(_index); tempData.IsNull = true; m_fileManager.Input(tempData); } else { TileManager.PlaceTile(m_tilesAround[_index].Pos, 0, WallGen.GetTilemap(), DungeonUtility.GetTilemap(), TileManager.GetTileHolder(TileType.Path).Tiles[0], DictionaryType.Floor); PlayBreakingEffect(_index); AddToStorage(_index); tempData.ID = TileManager.GetTileHolder(TileType.Path).Tiles[0].ID; tempData.IsNull = false; tempData.IsPlacedTile = true; m_fileManager.Input(tempData); } } } } }