Beispiel #1
0
        public override void Update(TimeSpan elapsed)
        {
            KeyboardState ks = Keyboard.GetState();

            if (ks.IsKeyUp(Keys.Escape) && ksLast.IsKeyDown(Keys.Escape))
            {
                GameState = GameState.Menu;

                if (GameContainer.SoundChannel == null)
                {
                    GameContainer.StartMusic(2);
                }
            }

            ksLast = ks;
        }
Beispiel #2
0
        public override void Update(TimeSpan elapsed)
        {
            float t = (float)elapsed.TotalSeconds;

            nickPos   += (nickVel * nickSpeed) * t;
            nickAlpha += nickAlphaIncrease * t;

            if (nickAlpha > 1)
            {
                nickAlphaIncrease = -nickAlphaIncrease + (-0.2f);
            }

            presentsPos   += (presentsVel * presentsSpeed) * t;
            presentsAlpha += presentsAlphaIncrease * t;

            if (presentsAlpha > 1)
            {
                presentsAlphaIncrease = -presentsAlphaIncrease + (-0.35f);
            }

            prodPos   += (prodVel * prodSpeed) * t;
            prodAlpha += prodAlphaIncrease * t;

            if (prodAlpha > 1)
            {
                prodAlphaIncrease = -prodAlphaIncrease + (-0.55f);
            }

            if (prodAlpha < -0.8f)
            {
                drawHelp = true;

                helpAlpha += 0.8f * t;

                if (prodAlpha < -10)
                {
                    stateController.GameState = GameState.Menu;
                    GameContainer.StartMusic(2);
                }
            }
        }