public TerrainMapTile(TerrainMapTile other, float height, Vector2 heightGradient) : base(other) { this.TerrainType = other.TerrainType; this.Height = height; this.HeightGradient = heightGradient; this.AdjacentTiles = other.AdjacentTiles; this.Improvement = other.Improvement; }
private bool MatchPred(Func <TerrainMapTile, bool> pred, int x, int y, out Vector3 foundPosition) { if (MapManager.InBounds(MapManager.Instance.map, x, y)) { //Debug.Log($"{x},{y} in bounds | {discoveredMapLocations[x, y]}"); TerrainMapTile left = MapManager.Instance.map[x, y]; if (discoveredMapLocations[x, y] && pred(left)) { foundPosition = new Vector3(x, y); return(true); } } foundPosition = new Vector3(-1, -1); return(false); }
private void ConvertMapGenerationToMapTiles(Dictionary <Terrain, TerrainMapTile> terrainTileLookup, Dictionary <Improvement, ImprovementMapTile> improvementTileLookup) { _minHeight = 100; _maxHeight = -100; map = new TerrainMapTile[MapGen.terrainMap.GetUpperBound(0) + 1, MapGen.terrainMap.GetUpperBound(1) + 1]; for (int i = 0; i <= MapGen.terrainMap.GetUpperBound(0); i++) { for (int j = 0; j <= MapGen.terrainMap.GetUpperBound(1); j++) { map[i, j] = new TerrainMapTile(terrainTileLookup[MapGen.terrainMap[i, j]], MapGen.heightMap[i, j], MapGen.LayeredGradientMap[i, j]); map[i, j].Improvement = new ImprovementMapTile(improvementTileLookup[MapGen.improvmentMap[i, j]]); map[i, j].ModifyBaseWithImprovement(); _minHeight = Mathf.Min(_minHeight, MapGen.heightMap[i, j]); _maxHeight = Mathf.Max(_maxHeight, MapGen.heightMap[i, j]); } } //Debug.Log($"min {_minHeight}, max {_maxHeight}"); }
public virtual void GatherSupplies(TerrainMapTile tile) { tile.Supply -= 1; Supply += 1; Supply = Mathf.Min(MaxSupply, Supply); }