Exemple #1
0
 /*********************************************************************************
 * Actor Functions
 *********************************************************************************/
 public void remove(intActor actorObject)
 {
     actors.Remove(actorObject);
 }
Exemple #2
0
        public void update()
        {
            if (inputControled)
            {
                float zoomScale = 1.25f;
                if (world.input.isActivated(InputActions.ZoomIn))
                {
                    this.size = new Vector2(this.size.X / zoomScale, this.size.Y / zoomScale);
                }

                if (world.input.isActivated(InputActions.ZoomOut))
                {
                    this.size = new Vector2(this.size.X * zoomScale, this.size.Y * zoomScale);
                }
            }


            // filter world objects to viewable items
            visibleObjects = new List <intObject>();
            foreach (intObject o in this.world.worldObjects)
            {
                if (this.isInVisibleArea(o.location))
                {
                    visibleObjects.Add(o);
                }
            }


            // camera overlay
            text = new List <string>();
            for (int a = 0; a < world.actors.Count; a++)
            {
                intActor driver = world.actors[a];

                clsDriverHuman driverHuman = driver as clsDriverHuman;   // Here is where I get typeof(IA)
                if (driverHuman != null)
                {
                    text.Add("--------------------");
                    text.Add("Name : " + driverHuman.car.name + " (" + a + ")");
                    text.Add("Speed : " + Math.Floor(driverHuman.car.mph) + " MPH");
                    //text.Add("Collisions : " + c.collisions.Count);
                    //text.Add("Direction : " + c.cardinalDirection.ToString());
                    //text.Add("Coordinates : ( " + c.location.X + " , " + c.location.Y + " )");
                    //text.Add("velocity : " + c.velocity.Length());
                    //text.Add("Steering : " + c.steeringWheel);
                    text.Add("Shifter : " + driverHuman.car.shifter.ToString().ToUpper());
                    text.Add("Acceleerator Pedal : " + driverHuman.car.acceleratorPedal);
                    text.Add("Break Pedal : " + driverHuman.car.breakPedal);
                }

                // route lines
                clsDriverAI driverAI = driver as clsDriverAI;
                if (driverAI != null)
                {
                    text.Add("--------------------");
                    text.Add("Name : " + driverAI.car.name + " (" + a + ")");
                    text.Add("Speed : " + Math.Floor(driverAI.car.mph) + " MPH");
                    text.Add("Obstruction : " + driverAI.route.distanceToNextObstruction);
                    text.Add("Collision : " + driverAI.route.distanceToNextCollision);
                    text.Add("Turn : " + driverAI.route.distanceToNextCollision);
                    text.Add("Yield : " + driverAI.yielding);
                    //text.Add("Direction : " + c.cardinalDirection.ToString());
                    //text.Add("Coordinates : ( " + c.location.X + " , " + c.location.Y + " )");
                    //text.Add("velocity : " + c.velocity.Length());
                    //text.Add("Steering : " + c.steeringWheel);
                    //text.Add("Shifter : " + c.shifter.ToString().ToUpper());
                    //text.Add("Acceleerator Pedal : " + c.acceleratorPedal);
                    //text.Add("Break Pedal : " + c.breakPedal);
                }
            }
        }