Beispiel #1
0
 public BoidSteering(Entity _character, Flock _flock, float _neighbourhoodMaxDistance, float _neighbourhoodMinDotProduct)
 {
     character = _character;
     flock = _flock;
     neighborhoodMaxDistance = _neighbourhoodMaxDistance;
     neighborhoodMinDotProduct = _neighbourhoodMinDotProduct;
 }
Beispiel #2
0
        public Separation(Entity _character, Flock _flock, float _neighbourhoodMaxDistance, float _neighbourhoodMinDotProduct)
            : base(_character, _flock, _neighbourhoodMaxDistance, _neighbourhoodMinDotProduct)
        {
            dummy = new DummyEntity();
            flee = new Flee(_character, dummy);

            maxNeighborhoodSize = 5;
        }
Beispiel #3
0
        // constructor
        public VelocityMatch(Entity _character, Flock _flock, float _maxDistance, float _minDotProduct)
            : base(_character, _flock, _maxDistance, _minDotProduct)
        {
            character = _character;
            flock = _flock;

            maxNeighborhoodSize = 10;
        }
Beispiel #4
0
        public Cohesion(Entity _character, Flock _flock, float _neighbourhoodMaxDistance, float _neighbourhoodMinDotProduct)
            : base(_character, _flock, _neighbourhoodMaxDistance, _neighbourhoodMinDotProduct)
        {
            dummy = new DummyEntity();
            seek = new Seek(character, dummy);

            maxNeighborhoodSize = 30;
        }
Beispiel #5
0
        /// <summary>
        /// Merges flocks and returns a new one
        /// </summary>
        public static Flock MergeFlocks(params Flock[] flocks)
        {
            Flock newFlock = new Flock();

            foreach (var f in flocks)
            {
                foreach (var boid in f.boids)
                {
                    if( !newFlock.boids.Exists(x => x == boid) )
                        newFlock.Add(boid);
                }
            }

            return newFlock;
        }
 /// <summary>
 /// Create the bird flock
 /// </summary>
 /// <param name="theNum"></param>
 protected void SpawnFlock()
 {
     if (flock == null)
     {
         flock = new Flock(birdTexture, GraphicsDevice.Viewport.TitleSafeArea.Width, 
                           GraphicsDevice.Viewport.TitleSafeArea.Height, flockParams);
     }
 }
        public FlockingSample()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

#if WINDOWS_PHONE || IOS
            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromTicks(333333);
            graphics.IsFullScreen = true;
#endif
            inputState = new InputState();

            flock = null;
            cat = null;

            flockParams = new AIParameters();
            ResetAIParams();
        }