void CreateTile(int x, int y, StageCellType type) { StageCell cell = new StageCell(x, y, type); GameObject editTile = Instantiate(editTilePrefab, transform); editTile.name = "tile(" + x + "," + y + ")"; SetTilePosition(editTile, x, y); StageEditTile tile = editTile.GetComponent <StageEditTile>(); tile.SetCell(cell); stageTiles.Add(tile); GameObject child = GetTileTypePrefab(type); if (child != null) { tile.EditType(type, child); } }
public GameObject GetTileTypePrefab(StageCellType type) { GameObject prefab = null; switch (type) { case StageCellType.Wall: prefab = wallPrefab; break; case StageCellType.ItemBox: prefab = itemBoxPrefab; break; case StageCellType.Goal: prefab = goalPrefab; break; case StageCellType.Player: prefab = playerPrefab; break; } return(prefab); }
public StageCell(int x, int y, StageCellType type) { this.x = x; this.y = y; this.type = type; }