Пример #1
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            switch (scene0.State + scene1.State + scene2.State)
            {
            case 0:
                scene0.Show();
                scene1.Hide();
                scene2.Hide();
                break;

            case 1:
                scene0.Hide();
                scene1.Show();
                scene2.Hide();
                break;

            case 2:
                scene0.Hide();
                scene1.Hide();
                scene2.Show();
                break;
            }
            base.Update(gameTime);
        }
Пример #2
0
 protected override void LoadContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     soundCenter = new SoundCenter(this);
     font        = Content.Load <SpriteFont>("MyFont");
     Services.AddService(typeof(SpriteBatch), spriteBatch);
     Services.AddService(typeof(SoundCenter), soundCenter);
     Services.AddService(typeof(SpriteFont), font);
     scene0 = new Scene0(this);
     scene1 = new Scene1(this, screenWidth, screenHeight, 1);
     scene2 = new Scene2(this, screenWidth, screenHeight);
     scene2.Hide();
     scene1.Hide();
     scene0.Show();
     Components.Add(scene0);
     Components.Add(scene1);
     Components.Add(scene2);
 }