Esempio n. 1
0
        public FlowFieldFollower(FlowFieldPlugIn plugin)
            : base(plugin.Annotations)
        {
            _plugin = plugin;

            _proximityToken = plugin.Database.AllocateToken(this);
        }
Esempio n. 2
0
        public FlowFieldFollower(FlowFieldPlugIn plugin)
            : base(plugin.Annotations)
        {
            _plugin = plugin;

            _proximityToken = plugin.Database.AllocateToken(this);
        }
Esempio n. 3
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;
 }
Esempio n. 4
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;
 }
Esempio n. 5
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();
		}
Esempio n. 6
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;
        }
Esempio n. 7
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();
        }
Esempio n. 8
0
        // switch to new proximity database -- just for demo purposes
        public void NewPD(IProximityDatabase <IVehicle> pd)
        {
            // delete this boid's token in the old proximity database
            if (_proximityToken != null)
            {
                _proximityToken.Dispose();
                _proximityToken = null;
            }

            // allocate a token for this boid in the proximity database
            _proximityToken = pd.AllocateToken(this);
        }
Esempio n. 9
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;
        }
Esempio n. 10
0
 public void Update(float currentTime, float elapsedTime)
 {
     _timer -= elapsedTime;
     if (!IsDead)
     {
         _trail.Record(currentTime, Position);
         ApplySteeringForce(SteerForPursuit(Target, 1) * 0.95f + SteerForWander(elapsedTime) * 0.05f, elapsedTime);
         _proximityToken.UpdateForNewPosition(Position);
     }
     else if (_proximityToken != null)
     {
         _proximityToken.Dispose();
         _proximityToken = null;
     }
 }
Esempio n. 11
0
 public void Update(float currentTime, float elapsedTime)
 {
     _timer -= elapsedTime;
     if (!IsDead)
     {
         _trail.Record(currentTime, Position);
         ApplySteeringForce(SteerForPursuit(Target, 1) * 0.95f + SteerForWander(elapsedTime) * 0.05f, elapsedTime);
         _proximityToken.UpdateForNewPosition(Position);
     }
     else if (_proximityToken != null)
     {
         _proximityToken.Dispose();
         _proximityToken = null;
     }
 }
Esempio n. 12
0
        //=========================================================================================================================

        public void Init(int side, FVector2 pos, float rotation)
        {
            this.Side     = side;
            this.Position = pos;

            IntObj3D = new InteractiveObject3D(this);
            ForegroundGame.IntObjs3D.Add(IntObj3D);
            IntObj2D = ForegroundGame.IntObjsManager.Add(this);

            proximityToken = BackgroundGame.IntObjsLQDB.AllocateToken(this);
            proximityToken.UpdateForNewPosition(new Point3D(pos.X.ToInt(), 0, pos.Y.ToInt()));


            onInitialize();

            Initialized = true;
        }
Esempio n. 13
0
		// switch to new proximity database -- just for demo purposes
		public void NewPD(IProximityDatabase<IVehicle> pd)
		{
			// delete this boid's token in the old proximity database
			if (_proximityToken != null)
			{
				_proximityToken.Dispose();
				_proximityToken = null;
			}

			// allocate a token for this boid in the proximity database
			_proximityToken = pd.AllocateToken(this);
		}