public void RemoveXnaComponent(GameComponent xnaComponent)
 {
     if (xnaComponent != null && Game.Components.Contains(xnaComponent))
     {
         Game.Components.Remove(xnaComponent);
         xnaComponent.Dispose();
     }
 }
Ejemplo n.º 2
0
        public void DisposedEventRaisedTest()
        {
            bool fired = false;

            gameComponent.Disposed += delegate { fired = true; };
            gameComponent.Dispose();
            Assert.IsTrue(fired);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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();
 }