Esempio n. 1
0
    public Map GenerateDungeon(Vector3 _dimensions, Biomes.Biome _biome)
    {
        Initiate(_dimensions, _biome);
        Map map = new Map(null, null);

        //TODO generate a dungeon

        List <Vector2> seaMarkers = GenerateSea(0);

        GenerateRiver(0, seaMarkers);



        map.ground  = ground;
        map.objects = objects;

        //TODO remove this again
        ExportBitmap();

        return(map);
    }
Esempio n. 2
0
    private void Initiate(Vector3 _dimensions, Biomes.Biome _biome)
    {
        dimensions     = _dimensions;
        biome          = _biome;
        canPlaceObject = new bool[Mathf.FloorToInt(dimensions.z)][][];
        ground         = new GroundType[Mathf.FloorToInt(dimensions.z)][][];
        objects        = new ObjectType[Mathf.FloorToInt(dimensions.z)][][];


        for (int z = 0; z < dimensions.z; z++)
        {
            canPlaceObject[z] = new bool[Mathf.FloorToInt(dimensions.y)][];
            ground[z]         = new GroundType[Mathf.FloorToInt(dimensions.y)][];
            objects[z]        = new ObjectType[Mathf.FloorToInt(dimensions.y)][];

            for (int y = 0; y < dimensions.y; y++)
            {
                canPlaceObject[z][y] = new bool[Mathf.FloorToInt(dimensions.x)];
                ground[z][y]         = new GroundType[Mathf.FloorToInt(dimensions.x)];
                objects[z][y]        = new ObjectType[Mathf.FloorToInt(dimensions.x)];

                for (int x = 0; x < dimensions.x; x++)
                {
                    canPlaceObject[z][y][x] = true;
                    ground[z][y][x]         = biome.mainTerrain;
                    objects[z][y][x]        = ObjectType.nothing;
                }
            }
        }
        groundColors = new Dictionary <GroundType, System.Drawing.Color>();
        groundColors.Add(GroundType.grass, System.Drawing.Color.Green);
        groundColors.Add(GroundType.water, System.Drawing.Color.Blue);
        groundColors.Add(GroundType.grass_dark, System.Drawing.Color.DarkGreen);
        groundColors.Add(GroundType.sand, System.Drawing.Color.Gold);
        //TODO add more ground types
    }
Esempio n. 3
0
 public void AddBiome(Biomes.Biome biome, int percentage)
 {
     _biomes.Add(biome);
     _percentage.Add(percentage);
     _totalPercentage += percentage;
 }