Beispiel #1
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;
 }
Beispiel #2
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;
 }
Beispiel #3
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);
        }
Beispiel #4
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;
        }
        private static ITokenForProximityDatabase<object> CreateToken(IProximityDatabase<object> db, Vector3 position, IDictionary<object, Vector3> lookup)
        {
            var obj = new object();

            if (lookup != null)
                lookup.Add(obj, position);

            var token = db.AllocateToken(obj);
            token.UpdateForNewPosition(position);

            return token;
        }
Beispiel #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;
        }
Beispiel #7
0
        private static ITokenForProximityDatabase <object> CreateToken(IProximityDatabase <object> db, Vector3 position, IDictionary <object, Vector3> lookup)
        {
            var obj = new object();

            if (lookup != null)
            {
                lookup.Add(obj, position);
            }

            var token = db.AllocateToken(obj);

            token.UpdateForNewPosition(position);

            return(token);
        }
Beispiel #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);
		}