Beispiel #1
0
        public World(string workingFolder, int size, int foodItems, int predatorItems, int maxX, int maxY)
        {
            _maxX          = maxX;
            _maxY          = maxY;
            _workingFolder = workingFolder;

            Cells = new Cell[size];

            for (int i = 0; i < size; ++i)
            {
                Cells[i] = new Cell(_random, maxX, maxY);
            }

            Foods = new Food[foodItems];
            for (int i = 0; i < foodItems; ++i)
            {
                Foods[i] = new Food(_random, maxX, maxY);
            }

            Predators = new Predator[predatorItems];
            for (int i = 0; i < predatorItems; ++i)
            {
                Predators[i] = new Predator(_random, maxX, maxY);
            }
        }
Beispiel #2
0
 public void Set(Predator item, float dx, float dy)
 {
     Item           = item;
     DirectionX     = dx;
     DirectionY     = dy;
     DistanceSquare = dx * dx + dy * dy;
 }