public TrafficDriver(string cfmFile, TrafficDriverDirection direction) { Vehicle = new Vehicle(cfmFile); //Vehicle.SteeringSpeed = 7; _direction = direction; if (direction == TrafficDriverDirection.Forward) { VirtualLane = MaxVirtualLanes - 1; } else { VirtualLane = 1; } }
public Actor(GeomCloneLevel setCurrentLevel, Vector2 setPosition, Vector2 setVelocity, float setMass, float setMaxSpeed, float setMaxForce, float setMaxTurnRate, float setBRadius) : base(setCurrentLevel.Game) { currentLevel = setCurrentLevel; //ID = nextID++; position = setPosition; bRadius = setBRadius; velocity = setVelocity * gameSpeed; rotation = 0.0f; parts = new List<ActorPart>(); v = new Vehicle(new Vector2(position.X * referenceWidth, position.Y * referenceHeight), velocity, setMass, setMaxSpeed * gameSpeed, setMaxForce, setMaxTurnRate, CurrentLevel.GetNeighbors, GameObject2D.referenceWidth, GameObject2D.referenceHeight); //CheckPositionBoundaries(); ChangeState(new NormalState(CurrentLevel, this)); }
public WallAvoidance(SteeringBehaviorsManager manager, Vehicle owner, float setFeelersLength, List<Wall> setWalls) : base(manager, owner) { feelers = new List<Vector2>(3); feelersLength = setFeelersLength; walls = setWalls; }
public Separation(SteeringBehaviorsManager manager, Vehicle theOwner) : base(manager,theOwner) { }
public SteeringBehavior(SteeringBehaviorsManager manager, Vehicle theOwner) { owner = theOwner; steeringBehaviorsManager = manager; }
public Pursuit(SteeringBehaviorsManager manager, Vehicle theOwner, Vehicle theEvader) : base(manager,theOwner) { evader = theEvader; seek = new Seek(manager, theOwner, new Vector2()); }
public Seek(SteeringBehaviorsManager manager, Vehicle theOwner, Vector2 targetPos) : base(manager, theOwner) { targetPosition = targetPos; }
public EvadeMulti(SteeringBehaviorsManager manager, Vehicle setOwner, float setMinDistance, GetVehicles updatePursuers, bool avoidBullets) : base(manager, setOwner) { minDistance = setMinDistance; minDistanceSquare = minDistance * minDistance; this.avoidBullets = avoidBullets; //evade = new Evade(manager, setOwner, null, setMinDistance); UpdatePursuers = updatePursuers; flee = new Flee(manager, setOwner, new Vector2()); }
public EvadeMulti(SteeringBehaviorsManager manager, Vehicle setOwner, float setMinDistance, GetVehicles updatePursuers) : this(manager, setOwner, setMinDistance, updatePursuers, false) { }
public Arrive(SteeringBehaviorsManager manager, Vehicle theOwner, Vector2 targetPos, Deceleration decel) : base(manager,theOwner) { targetPosition = targetPos; deceleration = decel; }
public Evade(SteeringBehaviorsManager manager, Vehicle theOwner, Vehicle thePursuer, float setMinDistance) : base(manager,theOwner) { pursuer = thePursuer; flee = new Flee(manager, theOwner, new Vector2()); minDistance = setMinDistance; minDistanceSquare = minDistance * minDistance; }
public void PursuitOn(Vehicle evader) { activeBehaviors.Add((int)BehaviorType.pursuit, new Pursuit(this, owner, evader)); }
public List<Vehicle> GetNeighbors(Vehicle v) { return getVehicles(); }
public void EvadeOn(Vehicle pursuer, float minDistance) { activeBehaviors.Add((int)BehaviorType.evade, new Evade(this, owner, pursuer, minDistance)); }
public SteeringBehaviorsManager(Vehicle theVehicle, GetVehicles getVehiclesFunction, int width, int height) { owner = theVehicle; activeBehaviors = new SortedDictionary<int, SteeringBehavior>(); // Function that returns all the active vehicles. Must be user-defined for flexibility. getVehicles = getVehiclesFunction; Width = width; Height = height; }
public Wander(SteeringBehaviorsManager manager, Vehicle theOwner, float setWandJitter, float setWandRadius, float setWandDist) : base(manager,theOwner) { wanderJitter = setWandJitter; wanderRadius = setWandRadius; wanderDistance = setWandDist; wanderTarget = RandomHelper.getRandomVector() * wanderRadius; }