Beispiel #1
0
        // Generate and populate the forest
        public override void Generate(Chunk chunkToPopulate)
        {
            // Set the constants
            name = "canyon";
            normalTemperature = 85;
            normalWindSpeed   = 20;
            associatedColor   = "$ea";
            // 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));

            if (random.Next(0, 10) == 0)
            {
                Creatures.CreatureGoat newGoat = new Creatures.CreatureGoat(chunkToPopulate.attachedApplication);
                newGoat.identifier.descriptiveAdjectives.Add("wild");
                newGoat.identifier.classifierAdjectives.Add("bearded");
                chunkToPopulate.AddChild(newGoat);
            }

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

                for (int i = 0; i < amontOfBoulders; i++)
                {
                    // Create a new piece of boulder
                    Minerals.MineralBasaltBoulder newBoulder = new Minerals.MineralBasaltBoulder();
                    chunkToPopulate.AddChild(newBoulder);
                }
            }
            // Decide whether to generate copper
            if (random.Next(1, 3) == 1)
            {
                // the amont of copper
                int amontOfCopper = random.Next(3, 10);

                for (int i = 0; i < amontOfCopper; i++)
                {
                    // Create a new piece of copper
                    Minerals.MineralCopper newCopper = new Minerals.MineralCopper();
                    chunkToPopulate.AddChild(newCopper);
                }
            }
            // Decide whether to generate gold
            if (random.Next(1, 5) == 1)
            {
                // the amont of gold
                int amontOfGold = random.Next(2, 5);

                for (int i = 0; i < amontOfGold; i++)
                {
                    // Create a new piece of gold
                    Minerals.MineralGold newGold = new Minerals.MineralGold();
                    chunkToPopulate.AddChild(newGold);
                }
            }
            #endregion
        }
        // Generate and populate the forest
        public override void Generate(Chunk chunkToPopulate)
        {
            // Set the constants
            name = "savanna";
            normalTemperature = 85;
            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));

            if (random.Next(0, 5) == 0)
            {
                Creatures.CreatureGoat newGoat = new Creatures.CreatureGoat(chunkToPopulate.attachedApplication);
                newGoat.identifier.descriptiveAdjectives.Add("wild");
                newGoat.identifier.classifierAdjectives.Add("bearded");
                chunkToPopulate.AddChild(newGoat);
            }

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

            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);
            }

            // the amont of acacia trees
            int amontOfAcaciaTrees = random.Next(1, 5);

            for (int i = 0; i < amontOfAcaciaTrees; i++)
            {
                // Create a new Acacia Trees
                Plants.PlantAcaciaTree newAcaciaTree = new Plants.PlantAcaciaTree();
                newAcaciaTree.identifier.name = "tree";

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

                newAcaciaTree.identifier.classifierAdjectives.Add("acacia");
                chunkToPopulate.AddChild(newAcaciaTree);
            }
            // the amont of acacia Branches
            int amontOfAcaciaBranches = random.Next(1, 3);

            for (int i = 0; i < amontOfAcaciaBranches; i++)
            {
                // Create a new acacia Branches
                Plants.PlantParts.PlantPartAcaciaTree.PlantPartAcaciaTreeBranch newAcaciaBranch = new Plants.PlantParts.PlantPartAcaciaTree.PlantPartAcaciaTreeBranch();
                newAcaciaBranch.identifier.name = "branch";

                // Make it eather long or short
                if (random.Next(0, 1) == 0)
                {
                    newAcaciaBranch.identifier.descriptiveAdjectives.Add("long");
                    newAcaciaBranch.specialProperties["weight"] = random.Next(5, 10).ToString();
                }
                else
                {
                    newAcaciaBranch.identifier.descriptiveAdjectives.Add("short");
                    newAcaciaBranch.specialProperties["weight"] = random.Next(2, 5).ToString();
                }


                newAcaciaBranch.identifier.classifierAdjectives.Add("acacia");
                chunkToPopulate.AddChild(newAcaciaBranch);
            }
            #endregion

            #region Add minerals
            // Decide whether to generate copper
            if (random.Next(1, 5) == 1)
            {
                // the amont of copper
                int amontOfCopper = random.Next(1, 2);

                for (int i = 0; i < amontOfCopper; i++)
                {
                    // Create a new piece of copper
                    Minerals.MineralCopper newCopper = new Minerals.MineralCopper();
                    chunkToPopulate.AddChild(newCopper);
                }
            }

            // 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);
                }
            }

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

                for (int i = 0; i < amontOfSalt; i++)
                {
                    // Create a new piece of salt
                    Minerals.MineralSalt newSalt = new Minerals.MineralSalt();
                    chunkToPopulate.AddChild(newSalt);
                }
            }
            #endregion
        }
        // Generate and populate the forest
        public override void Generate(Chunk chunkToPopulate)
        {
            // Set the constants
            name = "mountain";
            normalTemperature = 25;
            normalWindSpeed   = 30;
            associatedColor   = "$pa";
            // 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 minerals
            // the amont of gravel
            int amontOfGravel = random.Next(100, 200);

            for (int i = 0; i < amontOfGravel; i++)
            {
                // Create a new piece of sand
                Minerals.MineralGravel newGravel = new Minerals.MineralGravel();
                chunkToPopulate.AddChild(newGravel);
            }

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

                for (int i = 0; i < amontOfBoulders; i++)
                {
                    // Create a new boulder
                    Minerals.MineralBasaltBoulder newBoulder = new Minerals.MineralBasaltBoulder();
                    chunkToPopulate.AddChild(newBoulder);
                }
            }

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

                for (int i = 0; i < amontOfFlint; i++)
                {
                    // Create a new piece of boulder
                    Minerals.MineralFlint newFlint = new Minerals.MineralFlint();
                    chunkToPopulate.AddChild(newFlint);
                }
            }

            // the amont of rocks
            int amontOfRocks = random.Next(1, 5);

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

            // Decide whether to generate Lead
            if (random.Next(1, 3) == 1)
            {
                // the amont of Lead
                int amontOfLead = random.Next(1, 4);

                for (int i = 0; i < amontOfLead; i++)
                {
                    // Create a new piece of Lead
                    Minerals.MineralLead newLead = new Minerals.MineralLead();
                    chunkToPopulate.AddChild(newLead);
                }
            }
            // the amont of copper
            int amontOfCopper = random.Next(0, 5);

            for (int i = 0; i < amontOfCopper; i++)
            {
                // Create a new piece of copper
                Minerals.MineralCopper newCopper = new Minerals.MineralCopper();
                chunkToPopulate.AddChild(newCopper);
            }

            // Decide whether to generate a shell
            if (random.Next(1, 10) == 1)
            {
                // Create a new shell
                Minerals.MineralCalicoScallopShell newScallopShell = new Minerals.MineralCalicoScallopShell();
                chunkToPopulate.AddChild(newScallopShell);
            }
            #endregion
        }