예제 #1
0
        public override Vector2D Calculate()
        {
            Vector2D steeringForce = new Vector2D(0, 0);

            World.Instance.TagNeighbours(MovingEntity, 100);
            List <MovingEntity> entities = World.Instance.GetMovingEntities();

            steeringForce.Add(SteeringBehaviours.Cohesion(MovingEntity, entities).Multiply(cohesionAmount));
            steeringForce.Add(SteeringBehaviours.Alignment(MovingEntity, entities).Multiply(alignmentAmount));
            steeringForce.Add(SteeringBehaviours.Separation(MovingEntity, entities).Multiply(separationAmount));

            return(steeringForce.Truncate(maxSteeringForce));
        }
예제 #2
0
 public override Vector2D Calculate()
 {
     return(SteeringBehaviours.Flee(MovingEntity, World.Instance.Target.Pos));
 }