public override void Close() { _team1.Clear(); _team2.Clear(); _missiles.Clear(); _pd = null; }
private void CreateDatabase() { Vector3 center = Vector3.Zero; const float DIV = 10.0f; Vector3 divisions = new Vector3(DIV, DIV, DIV); const float DIAMETER = Fighter.WORLD_RADIUS * 2; Vector3 dimensions = new Vector3(DIAMETER, DIAMETER, DIAMETER); _pd = new LocalityQueryProximityDatabase<IVehicle>(center, dimensions, divisions); }
// constructor public Pedestrian(IProximityDatabase <IVehicle> pd, IAnnotationService annotations = null) : base(annotations) { // allocate a token for this boid in the proximity database _proximityToken = null; NewPD(pd); // reset Pedestrian state Reset(); }
private void CreateDatabase() { Vector3 center = Vector3.Zero; const float DIV = 10.0f; Vector3 divisions = new Vector3(DIV, DIV, DIV); const float DIAMETER = Fighter.WORLD_RADIUS * 2; Vector3 dimensions = new Vector3(DIAMETER, DIAMETER, DIAMETER); _pd = new LocalityQueryProximityDatabase <IVehicle>(center, dimensions, divisions); }
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; }
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; }
// 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(); }
// 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); }
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; }
// 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(); }
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; }
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); }
// 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); }
// constructor public Pedestrian(IProximityDatabase<IVehicle> pd, IAnnotationService annotations = null) :base(annotations) { // allocate a token for this boid in the proximity database _proximityToken = null; NewPD(pd); // reset Pedestrian state Reset(); }