Simple class storing all Steering Behaviors to ease their access in code
Пример #1
0
        /// <summary>
        /// Creates a new instance
        /// </summary>
        public AutonomousAgent()
        {
            ComputationMethod = SteeringComputationMethod.PrioritizedTruncatedWeighted;
            MaxForce = 2f;
            MinSpeed = 0f;
            MaxSpeed = 0f;
            MaxTurnRate = 1f;
            Mass = 1f;
            Deceleration = Deceleration.Normal;
            DecelerationTweaker = 0.5f;
            PanicDistance = 100.0f;
            SmoothRotation = true;
            UsesBanking = true;

            Add(new AutonomousAgentSeedInitializationBehavior());

            SteeringBehaviors = new Behaviors();

            _computeSteeringForcesBehavior = new ComputeSteeringForcesBehavior();
            Add(_computeSteeringForcesBehavior);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.WallAvoidance);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.ObstacleAvoidance);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Evade);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Flee);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Separation);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Alignment);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Cohesion);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Seek);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Arrive);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Wander);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Pursuit);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.OffsetPursuit);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Interpose);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.Hide);
            _computeSteeringForcesBehavior.Add(SteeringBehaviors.PathFollowing);


            Velocity = Vector3.Zero;
            VelocityForward = Vector3.Forward;
            VelocityRight = Vector3.Right;
            VelocityUp = Vector3.Up;
        }