コード例 #1
0
ファイル: Game1.cs プロジェクト: MarkMoerkerken/HunterExtreme
        /// <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()
        {
            StartScene startScene = new StartScene(this);

            this.Components.Add(startScene);
            Services.AddService <StartScene>(startScene);

            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);

            CreditScene creditScene = new CreditScene(this);

            this.Components.Add(creditScene);
            Services.AddService <CreditScene>(creditScene);

            GameOver gameOver = new GameOver(this);

            this.Components.Add(gameOver);
            Services.AddService <GameOver>(gameOver);

            HighScore highScore = new HighScore(this);

            this.Components.Add(highScore);
            Services.AddService <HighScore>(highScore);

            backRoundSong           = Content.Load <Song>("game music");
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume      = 0.1f;
            MediaPlayer.Play(backRoundSong);

            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();
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: talonernst/Shooter-Game
        /// <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()
        {
            this.Components.Add(new Background(this));
            // 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);

            CreditScene creditScene = new CreditScene(this);

            this.Components.Add(creditScene);
            Services.AddService <CreditScene>(creditScene);

            HighScoreScene highScoreScene = new HighScoreScene(this);

            this.Components.Add(highScoreScene);
            Services.AddService <HighScoreScene>(highScoreScene);

            // 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();
        }