Пример #1
0
        protected override void giveBirth(int currentRow, int currentCol, Aquarium[,] cells)
        {
            base.giveBirth(currentRow, currentCol, cells);

            bool[] variants = new bool[] { true, false };

            Predator baby = new Predator(1, variants[new Random().Next(2)]);

            var freeRandomCell = getFreeCell(currentRow, currentCol, cells);

            cells[freeRandomCell[0], freeRandomCell[1]] = baby;
        }
Пример #2
0
        protected override void giveBirth(int currentRow, int currentCol, object[,] cells, Aquarium aquarium, Grid DynamicGrid)
        {
            base.giveBirth(currentRow, currentCol, cells, aquarium, DynamicGrid);

            bool[] variants = new bool[] { true, false };

            var freeRandomCell = getFreeCell(currentRow, currentCol, cells, aquarium.aquariumSizeRow, aquarium.aquariumSizeColumn);

            Predator baby = new Predator(new int[] { freeRandomCell[0], freeRandomCell[1] }, "Child of " + this.name, 1, variants[new Random().Next(2)]);

            baby.digestibilityLevel = new Random().NextDouble();
            baby.isChecked          = true;

            cells[freeRandomCell[0], freeRandomCell[1]] = baby;

            Grid.SetRow(baby.gridElem, freeRandomCell[0]);
            Grid.SetColumn(baby.gridElem, freeRandomCell[1]);
            DynamicGrid.Children.Add(baby.gridElem);
        }