示例#1
0
文件: Game1.cs 项目: timfel/dash
        /// <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()
        {
            sound = new SoundManager(this);
            Components.Add(sound);

            intro = new IntroScreen(this);
            Components.Add(intro);
            intro.Enabled = true;

            gameplay = new GameplayComponent(this);
            Components.Add(gameplay);

            base.Initialize();
        }
示例#2
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            sprites = new SpriteManager(Game);
            Game.Components.Add(sprites);

            player = new Player(Game, this);
            Game.Components.Add(player);

            this.background = new Background(Game);
            Game.Components.Add(background);

            this.obstacles = new Obstacles(Game as Game1);
            Game.Components.Add(obstacles);

            AdGameComponent.Initialize(this.Game, "test_client");
            Game.Components.Add(AdGameComponent.Current);

            highscores = new HighscoreDisplay(Game);
            Game.Components.Add(highscores);
            CreateAd();

            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            this.sound = Game.Services.GetService(typeof(SoundManager)) as SoundManager;

            Enabled = false;
            Visible = true;

            base.Initialize();
        }
示例#3
0
文件: Player.cs 项目: timfel/dash
        public override void Initialize()
        {
            highscores = Game.Services.GetService(typeof(HighscoreDisplay)) as HighscoreDisplay;
            sound = Game.Services.GetService(typeof(SoundManager)) as SoundManager;

            Highscore.Lives = this.Lives;

            base.Initialize();
        }
示例#4
0
文件: Obstacles.cs 项目: timfel/dash
        public override void Initialize()
        {
            gameplay = Game.Services.GetService(typeof(GameplayComponent)) as GameplayComponent;
            sounds = Game.Services.GetService(typeof(SoundManager)) as SoundManager;

            base.Initialize();
        }