/// <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() { // TODO: use this.Content to load your game content here StartScene startScene = new StartScene(this); this.Components.Add(startScene); Services.AddService <StartScene>(startScene); //create other scenes here and add to component list ActionScene actionScene = new ActionScene(this); this.Components.Add(actionScene); Services.AddService <ActionScene>(actionScene); HelpScene helpScene = new HelpScene(this); this.Components.Add(helpScene); Services.AddService <HelpScene>(helpScene); AboutScene aboutScene = new AboutScene(this); this.Components.Add(aboutScene); Services.AddService <AboutScene>(aboutScene); Background background = new Background(this); this.Components.Add(new Background(this)); //Services.AddService<Background>(background); GameEndScene gameEndScene = new GameEndScene(this); this.Components.Add(gameEndScene); Services.AddService <GameEndScene>(gameEndScene); HighScoreScene highScoreScene = new HighScoreScene(this); this.Components.Add(highScoreScene); Services.AddService <HighScoreScene>(highScoreScene); Basket basket = new Basket(this); this.Components.Add(basket); Services.AddService <Basket>(basket); basket.Visible = false; // others..... base.Initialize(); // hide all then show our first scene // this has to be done after the initialize methods are called // on all our components HideAllScenes(); startScene.Show(); }
/// <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() { // TODO: use this.Content to load your game content here StartScene startScene = new StartScene(this); this.Components.Add(startScene); Services.AddService <StartScene>(startScene); //create other scenes here and add to component list ActionScene actionScene = new ActionScene(this); this.Components.Add(actionScene); Services.AddService <ActionScene>(actionScene); HelpScene helpScene = new HelpScene(this); this.Components.Add(helpScene); Services.AddService <HelpScene>(helpScene); AboutScene aboutScene = new AboutScene(this); this.Components.Add(aboutScene); Services.AddService <AboutScene>(aboutScene); EndScene endScene = new EndScene(this); this.Components.Add(endScene); Services.AddService <EndScene>(endScene); HighScoreScene highSocreScene = new HighScoreScene(this); this.Components.Add(highSocreScene); Services.AddService <HighScoreScene>(highSocreScene); // others..... Hero hero = new Hero(this); hero.Visible = false; Components.Add(hero); Services.AddService <Hero>(hero); base.Initialize(); // hide all then show our first scene // this has to be done after the initialize methods are called // on all our components HideAllScenes(); startScene.Show(); }