예제 #1
0
    public HomelandsLocation(HomelandsGame game, Pos pos, HomelandsTerrain terrain, HomelandsResource resource)
    {
        _pos    = pos;
        _game   = game;
        _viewer = game._viewer;

        _terrain  = terrain;
        _resource = resource;
    }
예제 #2
0
    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);
    }
예제 #3
0
    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);
    }
예제 #4
0
 public ExodusLocation(HomelandsGame game, Pos pos, HomelandsTerrain terrain, HomelandsResource resource) : base(game, pos, terrain, resource)
 {
 }
예제 #5
0
    public static HomelandsLocation Make(HomelandsGame game, Pos position, HomelandsTerrain terrain, HomelandsResource resource)
    {
        eGame gameType = game._settings._gameType;

        if (gameType == eGame.Exodus)
        {
            return(new ExodusLocation(game, position, terrain, resource));
        }
        else if (gameType == eGame.Sandbox)
        {
            return(new SandboxLocation(game, position, terrain, resource));
        }
        else
        {
            return(new SandboxLocation(game, position, terrain, resource));
            //throw new KeyNotFoundException();
        }
    }