Exemplo n.º 1
0
        public override void Redraw(float currentTime, float elapsedTime)
        {
            // selected vehicle (user can mouse click to select another)
            IVehicle selected = Demo.SelectedVehicle;

            // vehicle nearest mouse (to be highlighted)
            IVehicle nearMouse = null;            //FIXME: Demo.vehicleNearestToMouse ();

            // update camera
            Demo.UpdateCamera(currentTime, elapsedTime, selected);

            // draw "ground plane"
            Demo.GridUtility(selected.Position);

            // update, draw and annotate each agent
            for (int i = 0; i < all.Count; i++)
            {
                // draw this agent
                LowSpeedTurn agent = all[i];
                agent.Draw();

                // display speed near agent's screen position
                Color   textColor    = new Color(new Vector3(0.8f, 0.8f, 1.0f));
                Vector3 textOffset   = new Vector3(0, 0.25f, 0);
                Vector3 textPosition = agent.Position + textOffset;
                String  annote       = String.Format("{0:0.00}", agent.Speed);
                Drawing.Draw2dTextAt3dLocation(annote, textPosition, textColor);
            }

            // highlight vehicle nearest mouse
            Demo.HighlightVehicleUtility(nearMouse);
        }
Exemplo n.º 2
0
 public override void Reset()
 {
     // reset each agent
     LowSpeedTurn.ResetStarts();
     for (int i = 0; i < all.Count; i++)
     {
         all[i].Reset();
     }
 }
Exemplo n.º 3
0
        public override void Open()
        {
            // create a given number of agents with stepped inital parameters,
            // store pointers to them in an array.
            LowSpeedTurn.ResetStarts();
            for (int i = 0; i < lstCount; i++)
            {
                all.Add(new LowSpeedTurn());
            }

            // initial selected vehicle
            Demo.SelectedVehicle = all[0];

            // initialize camera
            Demo.Camera.Mode                        = Camera.CameraMode.Fixed;
            Demo.Camera.FixedUp                     = lstPlusZ;
            Demo.Camera.FixedTarget                 = lstViewCenter;
            Demo.Camera.FixedPosition               = lstViewCenter;
            Demo.Camera.FixedPosition.Y            += lstLookDownDistance;
            Demo.Camera.LookDownDistance            = lstLookDownDistance;
            Demo.Camera.FixedDistanceVerticalOffset = Demo.Camera2dElevation;
            Demo.Camera.FixedDistanceDistance       = Demo.CameraTargetDistance;
        }