Exemplo n.º 1
0
        public void GenerateBioms(int grass_amount, int water_amount)
        {
            Biom mainBiom = new Biom(Width, Height, BiomType.main, 0, 0, Width, Height);

            Form.DrawBiom(mainBiom);
            GenerateBiom(BiomType.grass, grass_amount);
            GenerateBiom(BiomType.water, water_amount);
        }
Exemplo n.º 2
0
 private void GenerateBiom(BiomType BiomType, int amount)
 {
     Biom[] NeededBiom = new Biom[amount];
     for (int i = 0; i < amount; i++)
     {
         NeededBiom[i] = new Biom(Width, Height, BiomType, random, Form);
         NeededBiom[i].GenerateBiom(ref Cells);
     }
 }
Exemplo n.º 3
0
        public void GenerateFlood()
        {
            Biom Flood;
            bool GeneratedFiitingFlood = false;

            if (!FloodStarted)
            {
                while (!GeneratedFiitingFlood)
                {
                    InitialFloodX      = random.Next(0, Width);
                    InitialFloodY      = random.Next(0, Height);
                    InitialFloodWidth  = random.Next(0, Width / 10);
                    InitialFloodHeight = random.Next(0, Height / 10);
                    if (InitialFloodX + InitialFloodWidth < Width && InitialFloodY + InitialFloodHeight < Height)
                    {
                        GeneratedFiitingFlood = true;
                    }
                }
                GeneratedFiitingFlood = false;
                FillCellsWithFlood(InitialFloodX, InitialFloodY, InitialFloodWidth, InitialFloodHeight);
                Flood        = new Biom(Width, Height, BiomType.water, InitialFloodX, InitialFloodY, InitialFloodWidth, InitialFloodHeight);
                FloodStarted = true;
            }
            else
            {
                int newFloodX = InitialFloodX, newFloodY = InitialFloodY, newFloodWidth = InitialFloodWidth, newFloodHeight = InitialFloodHeight;
                while (!GeneratedFiitingFlood)
                {
                    newFloodX      = random.Next(InitialFloodX, InitialFloodX + InitialFloodWidth);
                    newFloodY      = random.Next(InitialFloodY, InitialFloodY + InitialFloodHeight);
                    newFloodWidth  = random.Next(InitialFloodWidth / 5, InitialFloodWidth / 2);
                    newFloodHeight = random.Next(InitialFloodHeight / 5, InitialFloodHeight / 2);
                    if (newFloodX + newFloodWidth < Width && newFloodY + newFloodHeight < Height)
                    {
                        GeneratedFiitingFlood = true;
                    }
                }
                GeneratedFiitingFlood = false;
                FillCellsWithFlood(newFloodX, newFloodY, newFloodWidth, newFloodHeight);
                Flood = new Biom(Width, Height, BiomType.water, newFloodX, newFloodY, newFloodWidth, newFloodHeight);
            }
            Form.DrawBiom(Flood);
        }
Exemplo n.º 4
0
 public void DrawBiom(Biom biom)
 {
     graphics.FillRectangle(Colors[biom.BiomType.ToString()], biom.x, biom.y, biom.BiomWidth * scale, biom.BiomHeight * scale);
 }