/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { gc = new GameComponent(GraphicsDevice); UIComponent.Instance.spriteBatch = new SpriteBatch(GraphicsDevice); UIComponent.Instance.callbackShell = HandleUICallbacks; gc.Initialize(); UpdateGameState(GameStates.PLAYING); base.Initialize(); }
public void Register(GameComponent _GameComponent) { GameObjects.Add(_GameComponent); _GameComponent.Initialize(); }
protected void AddGameComponent(GameComponent component) { lock (gameComponents) { if (component != null && !(component is GuiBase) && !gameComponents.Contains(component)) { component.Initialize(); gameComponents.Add(component); collision2DManager.AddComponent(component); } } }