public void RemoveXnaComponent(GameComponent xnaComponent) { if (xnaComponent != null && Game.Components.Contains(xnaComponent)) { Game.Components.Remove(xnaComponent); xnaComponent.Dispose(); } }
public void DisposedEventRaisedTest() { bool fired = false; gameComponent.Disposed += delegate { fired = true; }; gameComponent.Dispose(); Assert.IsTrue(fired); }
protected override void Dispose(bool disposing) { if (disposing) { // Clean up. if (_sample != null) { Game.Components.Remove(_sample); _sample.Dispose(); } if (_guiGraphicsScreen != null) { _graphicsService.Screens.Remove(_guiGraphicsScreen); _guiGraphicsScreen.Dispose(); } } base.Dispose(disposing); }
public void goToNextState(States.State state) { for (int i = this.Components.Count - 1; i >= 0; i--) { if (this.Components[i] is GameComponent) { GameComponent temp = (GameComponent)this.Components[i]; temp.Dispose(); } } currentState = state; currentState.Initialize(); currentState.LoadContent(); }