Exemplo n.º 1
0
 public Game4(GameProperty gameproperty, Grass2Property grass2property, Herbivorous1Property herbivorous1property)
 {
     Type                 = 4;
     gameProperty         = gameproperty;
     grass2Property       = grass2property;
     herbivorous1Property = herbivorous1property;
 }
Exemplo n.º 2
0
 public override Cell[,] NextGeneration(Cell[,] gameField, Cell[,] gameFieldNext)
 {
     herbivorous1Property2             = new Herbivorous1Property(herbivorous1Property);
     herbivorous1Property2.EnergyBase -= herbivorous1Property2.EnergyConsumption;
     if (herbivorous1Property2.EnergyBase <= 0)
     {
         herbivorous1Property2.StartRot++;
         if (herbivorous1Property2.StartRot <= herbivorous1Property2.TimeRot)
         {
             gameFieldNext[CoordX, CoordY] = new Cell(new Herbivorous1(CoordX, CoordY, SizeX, SizeY, herbivorous1Property2, grass2Property), LivingName.Corpse, CoordX, CoordY);
         }
         else
         {
             gameFieldNext = GrowGrass(gameField, gameFieldNext);
         }
     }
     else
     {
         gameFieldNext = Move(gameField, gameFieldNext);
         if (herbivorous1Property2.EnergyBase >= herbivorous1Property2.EnergyBaseBegin + 2)
         {
             gameFieldNext = Duplication(gameField, gameFieldNext);
             herbivorous1Property2.EnergyBase = herbivorous1Property2.EnergyBaseBegin;
             gameFieldNext[CoordX, CoordY]    = new Cell(new Herbivorous1(CoordX, CoordY, SizeX, SizeY, herbivorous1Property2, grass2Property), livingName, CoordX, CoordY);
         }
     }
     return(gameFieldNext);
 }
Exemplo n.º 3
0
        public Cell[,] Duplication(Cell[,] gameField, Cell[,] gameFieldNext)
        {
            Point[] point = new Point[9];
            p = 0;
            for (int x = CoordX - 1; x <= CoordX + 1; x++)
            {
                for (int y = CoordY - 1; y <= CoordY + 1; y++)
                {
                    if (x < 0 || y < 0 || x >= SizeX || y >= SizeY ||
                        (x == CoordX && y == CoordY))
                    {
                        continue;
                    }

                    if (gameField[x, y] == null)
                    {
                        point[p].X = x;
                        point[p].Y = y;
                        p++;
                    }
                }
            }
            if (p != 0)
            {
                if (p != 1)
                {
                    p = generaterandom.RandomString(p);
                }
                else
                {
                    p = 0;
                }
                herbivorous1Property3 = new Herbivorous1Property(herbivorous1Property);
                herbivorous1Property3.EnergyBaseBegin   = Modification(herbivorous1Property2.EnergyBaseBegin);
                herbivorous1Property3.EnergyConsumption = Modification(herbivorous1Property2.EnergyConsumption);
                herbivorous1Property3.TimeRot           = Modification(herbivorous1Property2.TimeRot);
                herbivorous1Property3.StartRot          = herbivorous1Property2.StartRot;
                herbivorous1Property3.Grass2Radius      = Modification(herbivorous1Property2.Grass2Radius);
                herbivorous1Property3.EnergyGrass       = Modification(herbivorous1Property2.EnergyGrass);
                herbivorous1Property3.Speed             = Modification(herbivorous1Property2.Speed);
                herbivorous1Property3.EnergyBase        = herbivorous1Property2.EnergyBase - herbivorous1Property2.EnergyBaseBegin;
                gameFieldNext[point[p].X, point[p].Y]   = new Cell(new Herbivorous1(point[p].X, point[p].Y, SizeX, SizeY,
                                                                                    herbivorous1Property3, grass2Property), livingName, point[p].X, point[p].Y);
            }
            return(gameFieldNext);
        }
Exemplo n.º 4
0
 public Herbivorous1(int coordX, int coordY, int sizeX, int sizeY, Herbivorous1Property herbivorous1property, Grass2Property grass2property) : base(coordX, coordY, sizeX, sizeY)
 {
     livingName           = LivingName.Herbivorous1;
     herbivorous1Property = herbivorous1property;
     grass2Property       = grass2property;
 }