private void CreateSpecialTile(DS1.Cell cell, int x, int y, Transform parent) { // debug visualization DT1.Tile tile; if (specialTiles.Sample(cell.tileIndex, out tile)) { var renderer = CreateTile(tile, x, y, parent: parent); renderer.gameObject.layer = UnityLayers.SpecialTiles; } if (info == null) { return; } if (cell.mainIndex < 8) { int targetLevelId = info.vis[cell.mainIndex]; int warpId = info.warp[cell.mainIndex]; var targetLevel = LevelInfo.Find(targetLevelId); var levelWarpInfo = LevelWarpInfo.Find(warpId); if (levelWarpInfo == null) { Debug.LogWarning("Warp info wasn't found"); return; } Warp.Create(x, y, levelWarpInfo, info, targetLevel, parent); } }
private void CreateSpecialTile(DS1.Cell cell, int x, int y, Transform parent) { // debug visualization if (specialTiles.Sample(cell.tileIndex, out var tile)) { WorldState.instance.Grid.PutSpecialTile(tile, x, y); } if (info == null) { return; } if (cell.mainIndex < 8) { int targetLevelId = info.vis[cell.mainIndex]; int warpId = info.warp[cell.mainIndex]; var targetLevel = LevelInfo.Find(targetLevelId); var levelWarpInfo = LevelWarpInfo.Find(warpId); if (levelWarpInfo == null) { Debug.LogWarning("Warp info wasn't found"); return; } Warp.Create(x, y, levelWarpInfo, info, targetLevel, parent); } }
private Warp FindTargetWarp() { for (int i = 0; i < targetLevel.vis.Length; ++i) { if (targetLevel.vis[i] == sourceLevel.id) { int warpId = targetLevel.warp[i]; Warp warp = LevelWarpInfo.Find(warpId).instance; if (warp != null) { return(warp); } } } return(null); }