コード例 #1
0
        // Generate and populate the forest
        public override void Generate(Chunk chunkToPopulate)
        {
            // Set the constants
            name = "bog";
            normalTemperature = 30;
            normalWindSpeed   = 15;
            associatedColor   = "$ga";
            // Create a new random generator
            Random random = new Random();

            // Generate the chunks properties
            chunkToPopulate.windSpeed   = (normalWindSpeed * (random.Next(2, 8) / 5));
            chunkToPopulate.temperature = (normalTemperature * (random.Next(2, 4) / 3));

            #region Add plants
            // the amont of Tall Fescues
            int amontOfTallFescues = random.Next(50, 100);

            for (int i = 0; i < amontOfTallFescues; i++)
            {
                // Create a new Tall Fescue
                Plants.PlantTallFescue newTallFescue = new Plants.PlantTallFescue();
                newTallFescue.identifier.name = "grass";
                newTallFescue.identifier.descriptiveAdjectives.Add("lush");
                newTallFescue.identifier.descriptiveAdjectives.Add("tall");
                newTallFescue.identifier.classifierAdjectives.Add("fescue");
                chunkToPopulate.AddChild(newTallFescue);
            }

            // Decide whether to generate cattails
            if (random.Next(1, 3) == 1)
            {
                // the amont of cattails
                int amontOfCattails = random.Next(15, 30);

                for (int i = 0; i < amontOfCattails; i++)
                {
                    // Create a new Cattail
                    Plants.PlantCattail newCattail = new Plants.PlantCattail();
                    newCattail.identifier.name = "cattail";
                    chunkToPopulate.AddChild(newCattail);
                }
            }

            // Decide whether to generate reeds
            if (random.Next(1, 3) == 1)
            {
                // the amont of reeds
                int amontOfReeds = random.Next(15, 30);

                for (int i = 0; i < amontOfReeds; i++)
                {
                    // Create a new reed
                    Plants.PlantReed newReed = new Plants.PlantReed();
                    newReed.identifier.name = "reed";
                    chunkToPopulate.AddChild(newReed);
                }
            }
            #endregion

            #region Add minerals
            // the amont of Silt
            int amontOfSilt = random.Next(20, 50);

            for (int i = 0; i < amontOfSilt; i++)
            {
                // Create a new thing of silt
                Minerals.MineralSilt newSilt = new Minerals.MineralSilt();
                newSilt.identifier.name = "silt";
                chunkToPopulate.AddChild(newSilt);
            }
            #endregion
        }
コード例 #2
0
        // Generate and populate the forest
        public override void Generate(Chunk chunkToPopulate)
        {
            // Set the constants
            name = "swamp";
            normalTemperature = 75;
            normalWindSpeed   = 10;
            associatedColor   = "$ga";
            // Create a new random generator
            Random random = new Random();

            // Generate the chunks properties
            chunkToPopulate.windSpeed   = (normalWindSpeed * (random.Next(2, 8) / 5));
            chunkToPopulate.temperature = (normalTemperature * (random.Next(2, 4) / 3));

            #region Add plants

            // Decide whether to generate cattails
            if (random.Next(1, 3) == 1)
            {
                // the amont of cattails
                int amontOfCattails = random.Next(15, 30);

                for (int i = 0; i < amontOfCattails; i++)
                {
                    // Create a new Cattail
                    Plants.PlantCattail newCattail = new Plants.PlantCattail();
                    newCattail.identifier.name = "cattail";
                    chunkToPopulate.AddChild(newCattail);
                }
            }

            // Decide whether to generate reeds
            if (random.Next(1, 3) == 1)
            {
                // the amont of reeds
                int amontOfReeds = random.Next(15, 30);

                for (int i = 0; i < amontOfReeds; i++)
                {
                    // Create a new reed
                    Plants.PlantReed newReed = new Plants.PlantReed();
                    newReed.identifier.name = "reed";
                    chunkToPopulate.AddChild(newReed);
                }
            }

            // Decide whether to generate lilys
            if (random.Next(1, 3) == 1)
            {
                // the amont of lilys
                int amontOfLilys = random.Next(3, 8);

                for (int i = 0; i < amontOfLilys; i++)
                {
                    // Create a new Lilys
                    Plants.PlantLily newLily = new Plants.PlantLily();
                    newLily.identifier.name = "lily";
                    chunkToPopulate.AddChild(newLily);
                }
            }
            #endregion

            #region Add minerals
            // the amont of Silt
            int amontOfSilt = random.Next(20, 50);

            for (int i = 0; i < amontOfSilt; i++)
            {
                // Create a new thing of silt
                Minerals.MineralSilt newSilt = new Minerals.MineralSilt();
                newSilt.identifier.name = "silt";
                chunkToPopulate.AddChild(newSilt);
            }

            // Decide whether to generate boulder
            if (random.Next(1, 5) == 1)
            {
                // the amont of boulder
                int amontOfBoulders = random.Next(1, 2);

                for (int i = 0; i < amontOfBoulders; i++)
                {
                    // Create a new boulder
                    Minerals.MineralBasaltBoulder newBoulder = new Minerals.MineralBasaltBoulder();
                    chunkToPopulate.AddChild(newBoulder);
                }
            }
            #endregion
        }
コード例 #3
0
        // Generate and populate the forest
        public override void Generate(Chunk chunkToPopulate)
        {
            // Set the constants
            name = "jungle";
            normalTemperature = 90;
            normalWindSpeed   = 5;
            associatedColor   = "$ca";
            // Create a new random generator
            Random random = new Random();

            // Generate the chunks properties
            chunkToPopulate.windSpeed   = (normalWindSpeed * (random.Next(2, 8) / 5));
            chunkToPopulate.temperature = (normalTemperature * (random.Next(2, 4) / 3));

            #region Add plants
            // the amont of rubber trees
            int amontOfRubberTrees = random.Next(5, 15);

            for (int i = 0; i < amontOfRubberTrees; i++)
            {
                // Create a new rubber tree
                Plants.PlantRubberTree newRubberTree = new Plants.PlantRubberTree();
                newRubberTree.identifier.name = "tree";

                // Make it eather short or tall
                if (random.Next(0, 1) == 0)
                {
                    newRubberTree.identifier.descriptiveAdjectives.Add("short");
                }
                else
                {
                    newRubberTree.identifier.descriptiveAdjectives.Add("tall");
                }

                newRubberTree.identifier.classifierAdjectives.Add("rubber");
                chunkToPopulate.AddChild(newRubberTree);
            }

            // the amont of CrabGrass
            int amontOfCrabGrass = random.Next(100, 200);

            for (int i = 0; i < amontOfCrabGrass; i++)
            {
                // Create a new CrabGrass
                Plants.PlantCrabGrass newCrabGrass = new Plants.PlantCrabGrass();
                newCrabGrass.identifier.name = "grass";
                newCrabGrass.identifier.classifierAdjectives.Add("crab");
                chunkToPopulate.AddChild(newCrabGrass);
            }

            // Mkae some vines
            int amountOfVines = random.Next(2, 5);

            for (int i = 0; i < amountOfVines; i++)
            {
                // Create a new thing of silt
                Plants.PlantVine newVine = new Plants.PlantVine();
                newVine.identifier.name = "vine";
                chunkToPopulate.AddChild(newVine);
            }
            #endregion

            #region Add minerals
            // Decide whether to generate Silt
            if (random.Next(1, 3) == 1)
            {
                // the amont of Silt
                int amontOfSilt = random.Next(20, 50);

                for (int i = 0; i < amontOfSilt; i++)
                {
                    // Create a new thing of silt
                    Minerals.MineralSilt newSilt = new Minerals.MineralSilt();
                    newSilt.identifier.name = "silt";
                    chunkToPopulate.AddChild(newSilt);
                }
            }

            // Decide whether to generate rocks
            if (random.Next(1, 5) == 1)
            {
                // the amont of rocks
                int amontOfRocks = random.Next(1, 3);

                for (int i = 0; i < amontOfRocks; i++)
                {
                    // Create a new piece of rock
                    Minerals.MineralBasaltRock newRock = new Minerals.MineralBasaltRock();
                    chunkToPopulate.AddChild(newRock);
                }
            }
            #endregion
        }