示例#1
0
        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);
        }
示例#2
0
        public clsDriverAI createDriverAI(clsCar car, Vector2 exitLocation)
        {
            clsDriverAI ai = new clsDriverAI(this, car, exitLocation);

            actors.Add((intActor)ai);
            return(ai);
        }
示例#3
0
        /*****************************************
        *       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);
        }
示例#4
0
        /*****************************************
        *       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);
        }
示例#5
0
        public clsCar createCar(Vector2 worldLocation, Vector2 direction, Vector2 velocity)
        {
            clsCar car = new clsCar("car", worldLocation, direction, velocity);

            worldObjects.Add((intObject)car);
            return(car);
        }
示例#6
0
        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);
        }
示例#7
0
        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;
        }
示例#8
0
 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;
 }