Ejemplo n.º 1
0
        private void RandomizeBoids(int predatorCount, bool random)
        {
            Random rand = random ? new Random() : new Random(0);

            for (int i = 0; i < Boids.Length; i++)
            {
                Boids[i] = new Boid(
                    x: rand.NextDouble() * Width,
                    y: rand.NextDouble() * Height,
                    xVel: (rand.NextDouble() - .5),
                    yVel: (rand.NextDouble() - .5),
                    targetSpeed: .5 + rand.NextDouble());
                if (i < predatorCount)
                {
                    Boids[i].IsPredator   = true;
                    Boids[i].TargetSpeed += .5;
                }
            }
        }