// constructor public Boid(ProximityDatabase pd) { // allocate a token for this boid in the proximity database proximityToken = null; NewPD(pd); // reset all boid state Reset(); }
// switch to new proximity database -- just for demo purposes public void NewPD(ProximityDatabase 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); }