示例#1
0
    private int ChooseTerrain()
    {
        System.Random random = new System.Random();

        //TODO: Add game mode decisions for terrain
        TerrainGen terrainGen = new TerrainGen(materials, water, false, false);
        int        randNum    = random.Next(0, 99);

        //Flat - (VR)
        if (randNum <= 6)
        {
            terrainGen.landType = GenHeader.FLAT;
            terrainGen.MakeFlatTerrain();
        }
        //Plains - (Grasslands)
        else if (randNum > 6 && randNum <= 12)
        {
            terrainGen.landType = GenHeader.PLAINS;
            terrainGen.MakePlainsTerrain();
        }
        //Tundra - (Arctic)
        else if (randNum > 12 && randNum <= 18)
        {
            terrainGen.landType = GenHeader.TUNDRA;
            terrainGen.MakeTundraTerrain();
        }
        //Oasis - (Desert)
        else if (randNum > 18 && randNum <= 24)
        {
            terrainGen.landType = GenHeader.OASIS;
            terrainGen.MakeOasisTerrain();
        }
        //Steppe - (Forest/Desert)
        else if (randNum > 24 && randNum <= 30)
        {
            terrainGen.landType = GenHeader.STEPPE;
            terrainGen.MakeSteppeTerrain();
        }
        //Hill - (Countryside)
        else if (randNum > 30 && randNum <= 36)
        {
            terrainGen.landType = GenHeader.HILL;
            terrainGen.MakeHillTerrain();
        }
        //Desert - (Dune)
        else if (randNum > 36 && randNum <= 42)
        {
            terrainGen.landType = GenHeader.DESERT;
            terrainGen.MakeDesertTerrain();
        }
        //Mountain
        else if (randNum > 42 && randNum <= 48)
        {
            terrainGen.landType = GenHeader.MOUNTAIN;
            terrainGen.MakeMountainTerrain();
        }
        //Forest
        else if (randNum > 48 && randNum <= 54)
        {
            terrainGen.landType = GenHeader.FOREST;
            terrainGen.MakeForestTerrain();
        }
        //Marsh - (Bog)
        else if (randNum > 54 && randNum <= 60)
        {
            terrainGen.landType = GenHeader.MARSH;
            terrainGen.MakeMarshTerrain();
        }
        //Swamp
        else if (randNum > 60 && randNum <= 66)
        {
            terrainGen.landType = GenHeader.SWAMP;
            terrainGen.MakeSwampTerrain();
        }
        //City
        else if (randNum > 66 && randNum <= 72)
        {
            terrainGen.landType = GenHeader.CITY;
            terrainGen.MakeCityTerrain();
        }
        //Island
        else if (randNum > 72 && randNum <= 78)
        {
            terrainGen.landType = GenHeader.ISLAND;
            terrainGen.MakeIslandTerrain();
        }
        //Beach
        else if (randNum > 78 && randNum <= 84)
        {
            terrainGen.landType = GenHeader.BEACH;
            terrainGen.MakeBeachTerrain();
        }
        //Cave
        else if (randNum > 84 && randNum <= 90)
        {
            terrainGen.landType = GenHeader.CAVE;
            terrainGen.MakeCaveTerrain();
        }
        //Ocean
        else if (randNum > 90 && randNum <= 96)
        {
            terrainGen.landType = GenHeader.OCEAN;
            terrainGen.MakeOceanTerrain();
        }
        //Spire
        else
        {
            terrainGen.landType = GenHeader.SPIRE;
            terrainGen.MakeSpireTerrain();
        }

        terrainGen.seed.SetSeedLock(true);

        return(terrainGen.landType);
    }