// OnUnload() is called when the GameObject is removed from the IGameObjectService. protected override void OnUnload() { // Remove models from scene. foreach (var model in _models) { model.Parent.Children.Remove(_modelPrototype); model.Dispose(false); } // Remove rigid bodies from physics simulation. foreach (var body in _bodies) { body.Simulation.RigidBodies.Remove(body); } _models.Clear(); _bodies.Clear(); // Remove prototype. _modelPrototype.Dispose(false); _modelPrototype = null; _bodyPrototype = null; // Stop animation. var animationService = _services.GetInstance <IAnimationService>(); animationService.StopAnimation(_glowIntensity); _glowIntensity = null; }
// OnUnload() is called when the GameObject is removed from the IGameObjectService. protected override void OnUnload() { AnimationController.Stop(); AnimationController.Recycle(); _modelNode.Parent.Children.Remove(_modelNode); _modelNode.Dispose(false); _modelNode = null; }
protected override void Dispose(bool disposing) { if (disposing) { GraphicsScreen.Scene.Children.Remove(_modelNode); _modelNode.Dispose(false); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { _modelNode.Dispose(false); _debugRenderer.Dispose(); } base.Dispose(disposing); }
// OnUnload() is called when the GameObject is removed from the IGameObjectService. protected override void OnUnload() { // Remove model and rigid body. _modelNode.Parent.Children.Remove(_modelNode); _modelNode.Dispose(false); _modelNode = null; _rigidBody.Simulation.RigidBodies.Remove(_rigidBody); _rigidBody = null; }
protected override void Dispose(bool disposing) { if (disposing) { _saucerModelNode.Dispose(false); // Detach shape from rigid body to avoid any "memory leaks". _saucerBody.Shape = Shape.Empty; } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { // Abort decomposition. _convexDecomposition.CancelAsync(); _modelNode.Dispose(false); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { // IMPORTANT: Always dispose scene nodes if they are no longer needed! _model.Dispose(false); // Note: This statement disposes only our local clone. // The original instance is still available in the // ContentManager. } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { GraphicsScreen.Scene.Children.Remove(_grid); _grid.Dispose(false); GraphicsScreen.Scene.Children.Remove(_tank); _tank.Dispose(false); } base.Dispose(disposing); }
// OnUnload() is called when the GameObject is removed from the IGameObjectService. protected override void OnUnload() { // Remove model from scene graph. _modelNode.Parent.Children.Remove(_modelNode); _modelNode.Dispose(false); _modelNode = null; if (_rigidBody != null) { _rigidBody.Simulation.RigidBodies.Remove(_rigidBody); _rigidBody = null; } }
protected override void OnUnload() { // Remove the collision object from the collision domain. var collisionDomain = _collisionObject.Domain; collisionDomain.CollisionObjects.Remove(_collisionObject); // Detach objects to avoid any "memory leaks". _collisionObject.GeometricObject = null; _geometricObject.Shape = Shape.Empty; // Remove the model from the scene. _modelNode.Parent.Children.Remove(_modelNode); _modelNode.Dispose(false); }
protected override void Dispose(bool disposing) { if (disposing) { _animationController.Stop(); _animationController.Recycle(); GraphicsScreen.Scene.Children.Remove(_dudeModel); _dudeModel.Dispose(false); GraphicsScreen.Scene.Children.Remove(_sky); _sky.Dispose(false); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { // Remove game objects. GameObjectService.Objects.Remove(_cameraObject); // Remove graphics screen. GraphicsService.Screens.Remove(_delegateGraphicsScreen); // Dispose the other objects. _modelNode.Dispose(false); _debugRenderer.Dispose(); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { GameObjectService.Objects.Remove(_cameraObject); GraphicsService.Screens.Remove(_delegateGraphicsScreen); // IMPORTANT: Always dispose scene nodes if they are no longer needed! _model.Dispose(false); // Note: This statement disposes only our local clone. // The original instance is still available in the // ContentManager. _meshRenderer.Dispose(); _debugRenderer.Dispose(); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { // Clean up. GameObjectService.Objects.Remove(_grabObject); ParticleSystemService.ParticleSystems.Remove(_particleSystem); GraphicsScreen.Scene.Children.Remove(_particleSystemNode); _particleSystemNode.Dispose(false); GraphicsScreen.Scene.Children.Remove(_modelNode); _modelNode.Dispose(false); Simulation.RigidBodies.Remove(_rigidBody); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { // IMPORTANT: Always dispose scene nodes if they are no longer needed! _model.Dispose(false); // Note: This statement disposes only our local clone. // The original instance is still available in the // ContentManager. _meshRenderer.Dispose(); _debugRenderer.Dispose(); // Unload content. // (We have changed the properties of some loaded materials. Other samples // should use the default values. When we unload them now, the next sample // will reload them with default values.) ContentManager.Unload(); } base.Dispose(disposing); }
// OnUnload() is called when the GameObject is removed from the IGameObjectService. protected override void OnUnload() { // Remove the model from the scene. _modelNode.Parent.Children.Remove(_modelNode); _modelNode.Dispose(false); _modelNode = null; // Remove rigid bodies from simulation. var simulation = _floorRigidBody.Simulation; simulation.RigidBodies.Remove(_floorRigidBody); simulation.RigidBodies.Remove(_leftWallRigidBody); simulation.RigidBodies.Remove(_rightWallRigidBody); simulation.RigidBodies.Remove(_backWallRigidBody); simulation.RigidBodies.Remove(_frontWallRigidBody); _floorRigidBody = null; _leftWallRigidBody = null; _rightWallRigidBody = null; _backWallRigidBody = null; _frontWallRigidBody = null; }