Example #1
0
		// reset state
		public override void Reset()
		{
			base.Reset(); // reset the vehicle 
			Speed = 1.5f;         // speed along Forward direction.
			_trail = new Trail();
			_trail.Clear();    // prevent long streaks due to teleportation 
		}
Example #2
0
		// reset state
		public override void Reset()
		{
			// reset the underlying vehicle class
			base.Reset();

			// initially stopped
			Speed = 0;

			// vehicle is 2 meters wide and 3 meters long
			_halfWidth = 1.0f;
			_halfLength = 1.5f;

			// init dynamically controlled radius
			AdjustVehicleRadiusForSpeed();

			// not previously avoiding
			_annotateAvoid = Vector3.Zero;

			// 10 seconds with 200 points along the trail
			if (_trail == null) _trail = new Trail(10, 200);

			// prevent long streaks due to teleportation 
			_trail.Clear();

			// first pass at detecting "stuck" state
			Stuck = false;

			// QQQ need to clean up this hack
			_qqqLastNearestObstacle = Vector3.Zero;

			// master look ahead (prediction) time
			_baseLookAheadTime = 3;

			if (DemoSelect == 2)
			{
				LapsStarted++;
				const float S = WORLD_SIZE;
				float d = PathFollowDirection;
				Position = (new Vector3(S * d * 0.6f, 0, S * -0.4f));
				RegenerateOrthonormalBasisUF(Vector3.UnitX * d);
			}

			// reset bookeeping to detect stuck cycles
			ResetStuckCycleDetection();

			// assume no previous steering
			_currentSteering = Vector3.Zero;

			// assume normal running state
			_dtZero = false;

			// QQQ temporary global QQQoaJustScraping
			_qqQoaJustScraping = false;

			// state saved for speedometer
			AnnoteMaxRelSpeed = AnnoteMaxRelSpeedCurve = AnnoteMaxRelSpeedPath = 0;
			AnnoteMaxRelSpeed = AnnoteMaxRelSpeedCurve = AnnoteMaxRelSpeedPath = 1;
		}
        public override void Reset()
        {
            base.Reset();

            RandomizeStartingPositionAndHeading();  // new starting position

            _trail = new Trail(7.5f, 600);
            _trail.Clear();
        }
Example #4
0
		// reset state
		public override void Reset()
		{
			base.Reset(); // reset the vehicle 
			Speed = 0.0f;         // speed along Forward direction.

			Position = new Vector3(0, 0, 0);
			if (_trail == null) _trail = new Trail(100, 6000);
			_trail.Clear();    // prevent long streaks due to teleportation 
		}
Example #5
0
 public Missile(IProximityDatabase<IVehicle> proximity, IVehicle target, IAnnotationService annotation)
     :base(annotation)
 {
     _trail = new Trail(1, 10)
     {
         TrailColor = Color.Red,
         TickColor = Color.DarkRed
     };
     _proximityToken = proximity.AllocateToken(this);
     Target = target;
 }
Example #6
0
		// constructor
		public Boid(IProximityDatabase<IVehicle> pd, IAnnotationService annotations = null)
            :base(annotations)
		{
			// allocate a token for this boid in the proximity database
			_proximityToken = null;
			NewPD(pd);

		    _trail = new Trail(2f, 60);

			// reset all boid state
			Reset();
		}
Example #7
0
        public Fighter(IProximityDatabase<IVehicle> proximity, IAnnotationService annotation, Action<Fighter, Fighter> fireMissile)
            :base(annotation)
        {
            _trail = new Trail(5, 50)
            {
                TrailColor = Color.WhiteSmoke,
                TickColor = Color.LightGray
            };
            _proximityToken = proximity.AllocateToken(this);

            _fireMissile = fireMissile;
        }
Example #8
0
	    // reset state
		public override void Reset()
		{
			base.Reset();  // reset the vehicle 

			Speed = 3;             // speed along Forward direction.

			Avoiding = false;         // not actively avoiding

			RandomizeStartingPositionAndHeading();  // new starting position

			Trail = new Trail();
			Trail.Clear();     // prevent long streaks due to teleportation
		}
Example #9
0
		// reset state
		public override void Reset()
		{
			base.Reset(); // reset the vehicle 
			Speed = 0.0f;         // speed along Forward direction.

			// Place me on my part of the field, looking at oponnents goal
			Position = new Vector3(_imTeamA ? RandomHelpers.Random() * 20 : -RandomHelpers.Random() * 20, 0, (RandomHelpers.Random() - 0.5f) * 20);
			if (_myID < 9)
			{
				Position = _imTeamA ? (Globals.PlayerPosition[_myID]) : (new Vector3(-Globals.PlayerPosition[_myID].X, Globals.PlayerPosition[_myID].Y, Globals.PlayerPosition[_myID].Z));
			}
			_home = Position;

			if (_trail == null) _trail = new Trail(10, 60);
			_trail.Clear();    // prevent long streaks due to teleportation 
		}
Example #10
0
		// reset state
		public override void Reset()
		{
			// reset vehicle state
			base.Reset();

			// speed along Forward direction.
			Speed = _startSpeed;

			// initial position along X axis
			Position = new Vector3(_startX, 0, 0);

			// for next instance: step starting location
			_startX += 2;

			// for next instance: step speed
			_startSpeed += 0.15f;

			// 15 seconds and 150 points along the trail
			_trail = new Trail(15, 150);
		}
Example #11
0
		// reset all instance state
		public override void Reset()
		{
			// reset the vehicle 
			base.Reset();

			// initially stopped
			Speed = 0;

			// size of bounding sphere, for obstacle avoidance, etc.
			Radius = 0.5f; // width = 0.7, add 0.3 margin, take half

			// set the path for this Pedestrian to follow
			_path = Globals.GetTestPath();

			// set initial position
			// (random point on path + random horizontal offset)
			float d = _path.TotalPathLength * RandomHelpers.Random();
			float r = _path.Radius;
			Vector3 randomOffset = Vector3Helpers.RandomVectorOnUnitRadiusXZDisk() * r;
			Position = (_path.MapPathDistanceToPoint(d) + randomOffset);

			// randomize 2D heading
			RandomizeHeadingOnXZPlane();

			// pick a random direction for path following (upstream or downstream)
			_pathDirection = RandomHelpers.Random() <= 0.5;

			// trail parameters: 3 seconds with 60 points along the trail
			_trail = new Trail(3, 60);

			// notify proximity database that our position has changed
			if (_proximityToken != null) _proximityToken.UpdateForNewPosition(Position);
		}