예제 #1
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);
        }
예제 #2
0
        public void Dispose()
        {
            Initialized = false;

            proximityToken.Dispose();

            if (IntObj2D.selected)
            {
                InGameLayer.instance.RefreshSelection();
            }
            ForegroundGame.IntObjsManager.Remove(IntObj2D);

            onDestroy();
        }
예제 #3
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;
     }
 }