Exemple #1
0
        public override void Open()
        {
            // make the database used to accelerate proximity queries
            _cyclePD = -1;
            NextPD();

            // create the specified number of Pedestrians
            _population = 0;
            for (int i = 0; i < 100; i++)
            {
                AddPedestrianToCrowd();
            }

            // initialize camera and selectedVehicle
            Pedestrian firstPedestrian = _crowd[0];

            Demo.Init3dCamera(firstPedestrian);
            Demo.Camera.Mode = Camera.CameraMode.FixedDistanceOffset;

            Demo.Camera.FixedTarget.X = 15;
            Demo.Camera.FixedTarget.Y = 0;
            Demo.Camera.FixedTarget.Z = 30;

            Demo.Camera.FixedPosition.X = 15;
            Demo.Camera.FixedPosition.Y = 70;
            Demo.Camera.FixedPosition.Z = -70;
        }
Exemple #2
0
        void AddPedestrianToCrowd()
        {
            _population++;
            Pedestrian pedestrian = new Pedestrian(_pd, Annotations);

            _crowd.Add(pedestrian);
            if (_population == 1)
            {
                Demo.SelectedVehicle = pedestrian;
            }
        }
Exemple #3
0
        void RemovePedestrianFromCrowd()
        {
            if (_population > 0)
            {
                // save pointer to last pedestrian, then remove it from the crowd
                _population--;
                Pedestrian pedestrian = _crowd[_population];
                _crowd.RemoveAt(_population);

                // if it is OpenSteerDemo's selected vehicle, unselect it
                if (pedestrian == Demo.SelectedVehicle)
                {
                    Demo.SelectedVehicle = null;
                }
            }
        }
		void AddPedestrianToCrowd()
		{
			_population++;
			Pedestrian pedestrian = new Pedestrian(_pd, Annotations);
			_crowd.Add(pedestrian);
			if (_population == 1) Demo.SelectedVehicle = pedestrian;
		}