/// <summary> /// Adds a new component to this layer /// </summary> /// <param name="component">The component to add</param> public void Add(DrawableGameComponent component) { _children.Add(component); component.Initialize(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here shotHandlerGroup = new ProjectileHandlerGroup(this, spriteBatch); shotHandlerGroup.Initialize(); bg = new Background(this as Game); bg.Initialize(); fps = new FPSCounter(this as Game); fps.Initialize(); planet = new HomePlanet(this as Game); planet.Initialize(); planetHud = new PlanetStatusDisplay(this as Game, planet as HomePlanet); planetHud.Initialize(); planetBasis = new PlanetBasis(this as Game,spriteBatch,shotHandlerGroup); planetBasis.Initialize(); enemy = new BaseEnemy(this, spriteBatch, 1.0f, new Vector2(900, 800)); enemy.Initialize(); }
protected void AddDrawableGameComponent(DrawableGameComponent component) { lock (drawableGameComponents) { if (component != null && !(component is GuiBase) && !drawableGameComponents.Contains(component)) { component.Initialize(); component.CallMethod("LoadContent", null); collision2DManager.AddComponent(component); drawableGameComponents.Add(component); } } }