public Dictionary <Pos, HomelandsLocation> Make(MapSettings mapSettings) { IMapLocSetter mapLocSetter = MapLocSetterFactory.Make(mapSettings._tileShape); Dictionary <Pos, HomelandsLocation> locations = BuildLocations(mapSettings, mapLocSetter); SetNeighbors(mapSettings, locations); return(locations); }
Dictionary <Pos, HomelandsLocation> BuildLocations(MapSettings mapSettings, IMapLocSetter mapLocSetter) { Dictionary <Pos, HomelandsLocation> locations = new Dictionary <Pos, HomelandsLocation>(); for (int x = 0; x < mapSettings._xDim; x++) { for (int y = 0; y < mapSettings._yDim; y++) { Loc l = new Loc(x, y); Pos p = new Pos(l, mapLocSetter); HomelandsTerrain terrain = new HomelandsTerrain(eTerrain.Land); HomelandsResource resource = GetResource(x, y); locations[p] = LocationFactory.Make(_game, p, terrain, resource); } } return(locations); }
public Dictionary <Pos, HomelandsLocation> Make(MapSettings settings) { Debug.Log("Making Map"); GaeaWorldbuilder map = new GaeaWorldbuilder(settings); map.GenerateMap(); IMapLocSetter mapLocSetter = MapLocSetterFactory.Make(_tileShape); Dictionary <Pos, HomelandsLocation> locations = BuildLocations(map, mapLocSetter); SetNeighbors(settings, locations); Debug.Log("Made Map"); return(locations); }
Dictionary <Pos, HomelandsLocation> BuildLocations(GaeaWorldbuilder map, IMapLocSetter mapLocSetter) { Dictionary <Pos, HomelandsLocation> locations = new Dictionary <Pos, HomelandsLocation>(); for (int x = 0; x < map.xDim; x++) { for (int y = 0; y < map.yDim; y++) { Loc l = new Loc(x, y); Pos p = new Pos(l, mapLocSetter); Dictionary <string, float> locationQualities = map.GetLocationQualities(x, y); HomelandsTerrain terrain = GetTerrain(map, locationQualities); HomelandsResource resource = terrain._type == eTerrain.Land && Random.Range(0f, 1f) > 0.90f ? new HomelandsResource() : null; locations[p] = LocationFactory.Make(_game, p, terrain, resource); } } return(locations); }
public Pos(Loc _loc, IMapLocSetter mapLocSetter) { _gridLoc = _loc; _mapLoc = mapLocSetter.GetMapLoc(this); }