public clsDriverAI spawnCarAI(Vector2 worldLocation, Vector2 direction, Vector2 velocity, Vector2 destination) { clsCar car = createCar(worldLocation, direction, velocity); // spanw car clsDriverAI AI = createDriverAI(car, destination); // create AI for the car return(AI); }
public clsDriverAI createDriverAI(clsCar car, Vector2 exitLocation) { clsDriverAI ai = new clsDriverAI(this, car, exitLocation); actors.Add((intActor)ai); return(ai); }
/***************************************** * Instance Objects in the world *****************************************/ public clsDriverHuman spawnCarLocalHuman(clsWorld world, Vector2 worldLocation, Vector2 direction, Vector2 velocity) { clsCar car = createCar(worldLocation, direction, velocity); // spanw car clsDriverHuman human = createDriverHuman(world, car, this.input); // create human for the car return(human); }
/***************************************** * Instance Game Intelegence hooks *****************************************/ public clsDriverHuman createDriverHuman(clsWorld world, clsCar car, clsInput input) { clsDriverHuman human = new clsDriverHuman(world, car, input); // assign human to it actors.Add((intActor)human); return(human); }
public clsCar createCar(Vector2 worldLocation, Vector2 direction, Vector2 velocity) { clsCar car = new clsCar("car", worldLocation, direction, velocity); worldObjects.Add((intObject)car); return(car); }
public Vector2 getDirection(clsCar car, Vector2 destinationLocation) { // get direction of way point from cars location //Vector2 b = car.location - destination; Vector2 b = destinationLocation - car.location; Vector2 destinationDirection = new Vector2(b.X, b.Y); destinationDirection.Normalize(); return(destinationDirection); }
float speedComplianceVariationPercentage; // faster or slower than normal. (e.g. 10% slower than normal) public clsDriverAI(clsRoadWorld world, clsCar car, Vector2 destination) : base(world, car) { // inputs this.car = car; this.destination = destination; this.yieldStartTime = 0; // calculate route calculateShortestRoute(car.location, destination); // driver differences //speedRangePercentage = (car.world.random.Next(10) - 5) / 100.0f; //speedComplianceVariationPercentage = (car.world.random.Next(10) - 5) / 100.0f; // start timer this.lastUpdated = world.currentTime; }
public clsDriverHuman(clsWorld world, clsCar car, clsInput input) : base(world, car) { // could have an input that is network at some point this.car = car; this.input = input; }