Exemplo n.º 1
0
        //Unregister a BulletBehavior from the simulation callback
        public static void Unregister(BulletBehaviour behavior)
        {
            if (_decommisioning)
            {
                return;
            }

            Instance.Unregister_Internal(behavior);
        }
        //Register a BulletBehavior with the simulation callback
        public override void Register(BulletBehaviour behavior)
        {
            //Initialize the world and warn the user if it hasn't already been initialized
            if (!_initlialized)
            {
                InitializeWorld(BulletUpdate);
                Debug.LogWarning("A BulletBehavior attempted to register with the simulation callback before it was initialized!\n" +
                                 "Please check your script execution order");
            }

            //Check if already registered and warn the user
            if (_bulletBehaviors.Contains(behavior))
            {
                Debug.LogError("Specified BulletBehavior has already been registered with the simulation callback!\n");
                return;
            }

            //Register the BulletBehavior with the simulation callback
            _bulletBehaviors.Add(behavior);
        }
        //Unregister a BulletBehavior from the simulation callback
        public override void Unregister(BulletBehaviour behavior)
        {
            //Warn the user if the physics world has not been initialized
            if (!_initlialized)
            {
                Debug.LogError("A BulletBehavior attempted to unregister from the simulation callback before it was initialized!\n" +
                               "Please check your scene setup!");
                return;
            }

            //Check if the specified Object has been registered
            if (!_bulletBehaviors.Contains(behavior))
            {
                Debug.LogError("Specified object has not been registered with this simulation!\n" +
                               "Please check your scene setup!");
                return;
            }

            //Unregister the Bullet object from the simulation and callback
            _bulletBehaviors.Remove(behavior);
        }
Exemplo n.º 4
0
 private void Unregister_Internal(BulletBehaviour behaviour)
 {
     // Select the world and unregister with it
     _discretePhysicsWorld.Unregister(behaviour);
 }
 // Unregister with the physics world
 public virtual void Unregister(BulletBehaviour behaviour)
 {
     throw new UnsupportedWorldTypeException(UNSUPPORTED_WORLD_TYPE_MESSAGE);
 }