public void Setup() { _woodsTile = new WoodsTile[8]; for (int i = 0; i < _woodsTile.Length; i++) { _woodsTile[i] = new WoodsTile(); } _firstTile = _woodsTile[0]; _sawmillTile = new SawmillTile(); }
public TerrainTile CreateTerrainFromType(TerrainType type, BaseTileData baseTileData) { TerrainTile newTile = null; TerrainBinding terrainBinding = GetTerrainBindingFromType(type); if (terrainBinding != null) { switch (type) { case TerrainType.Plains: newTile = new PlainsTile(); break; case TerrainType.Water: newTile = new WaterTile(); break; case TerrainType.Wood: newTile = new WoodsTile(); break; case TerrainType.Stone: newTile = new StoneTile(); break; case TerrainType.Sand: newTile = new SandTile(); break; default: throw new MissingTerrainTypeDefinitionException(); } } baseTileData.terrainTile = newTile; TerrainInfo terrainInfo = Instantiate(terrainBinding.terrainVisualInfo, baseTileData.worldPosition, Quaternion.identity, _terrainTilemap.transform); terrainInfo.dataTile = newTile; newTile.terrainInfo = terrainInfo; newTile.GridPosition = baseTileData.GridPosition; return(newTile); }