Example #1
0
        public override void Update(GameTime gameTime)
        {
            time += (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (cheatTextCurrentColor != Color.Transparent)
            {
                cheatTextCurrentColor = Color.Lerp(Color.Gold, Color.Transparent, ((float)gameTime.TotalGameTime.TotalSeconds - cheatInputTime) / 4f);
            }

            if (fadephase < 2 && (KeyboardManager.KeyPressedUp(Keys.Space) || KeyboardManager.KeyPressedUp(Keys.Enter) || KeyboardManager.KeyPressedUp(Keys.Escape) || GamepadManager.ProceedButtonPressedUp()))
            {
                backgroundCurrentColor = Color.White;
                text1CurrentColor      = Color.White;
                text2CurrentColor      = Color.White;
                startTextColor         = Color.White;
                startTextNextChange    = time + .8f;
                fadephase = 2;
            }
            else if (fadephase == 2)
            // Process input on the main screen...
            {
                if (KeyboardManager.KeyDown(Keys.LeftShift) || GamepadManager.AnyShoulderButtonDown())
                {
                    // Get the input to add to the cheat string.
                    if (KeyboardManager.KeyPressedUp(Keys.Up) || GamepadManager.UpButtonPressedUp())
                    {
                        cheatInputText = String.Concat(cheatInputText, "U");
                    }
                    if (KeyboardManager.KeyPressedUp(Keys.Down) || GamepadManager.DownButtonPressedUp())
                    {
                        cheatInputText = String.Concat(cheatInputText, "D");
                    }
                    if (KeyboardManager.KeyPressedUp(Keys.Left) || GamepadManager.LeftButtonPressedUp())
                    {
                        cheatInputText = String.Concat(cheatInputText, "L");
                    }
                    if (KeyboardManager.KeyPressedUp(Keys.Right) || GamepadManager.RightButtonPressedUp())
                    {
                        cheatInputText = String.Concat(cheatInputText, "R");
                    }

                    CheckCheats(gameTime);
                }
                else
                {
                    cheatInputText = "";
                }


                if ((KeyboardManager.KeyPressedDown(Keys.Enter) || GamepadManager.ProceedButtonPressedUp()) && !HelpShown && !CreditsShown)
                {
                    // Begin the game...
                    fadephase = 3;
                    music.Stop();
                    time                = 0f;
                    startTextColor      = Color.White;
                    startTextNextChange = 0.05f;
                    GameStartSound.Play();
                }
                else
                {
                    if (KeyboardManager.KeyDown(Keys.C))
                    {
                        CreditsShown = true;
                    }
                    else
                    {
                        CreditsShown = false;
                    }

                    if (KeyboardManager.KeyDown(Keys.H))
                    {
                        HelpShown = true;
                    }
                    else
                    {
                        HelpShown = false;
                    }
                }
            }

            switch (fadephase)
            {
            case (0):
                backgroundCurrentColor = Color.Lerp(Color.Black, Color.White, time / 3f);
                if (backgroundCurrentColor == Color.White)
                {
                    fadephase = 1;
                }
                break;

            case (1):
                if (time > 3.5f)
                {
                    text1CurrentColor = Color.Lerp(Color.Transparent, Color.White, (time - 3.5f) / 1.8f);
                    text2CurrentColor = Color.Lerp(Color.Transparent, Color.White, (time - 5f) / 3f);
                }
                if (time > 8f)
                {
                    startTextColor      = Color.White;
                    startTextNextChange = 8.8f;
                    fadephase           = 2;
                }
                break;

            case (2):
            {
                if (time > startTextNextChange)
                {
                    if (startTextColor == Color.White)
                    {
                        startTextColor = Color.Transparent;
                    }
                    else
                    {
                        startTextColor = Color.White;
                    }

                    startTextNextChange += .8f;
                }
            }
            break;

            case (3):
                if (time > startTextNextChange)
                {
                    if (startTextColor == Color.White)
                    {
                        startTextColor = Color.Yellow;
                    }
                    else
                    {
                        startTextColor = Color.White;
                    }

                    startTextNextChange += .05f;
                }
                if (time > 1.5f)
                {
                    startTextColor = Color.Transparent;
                    fadephase      = 4;
                    time           = 0;
                }
                break;

            case (4):
                backgroundCurrentColor = Color.Lerp(Color.White, Color.Black, time / 1.5f);
                text1CurrentColor      = Color.Lerp(Color.White, Color.Black, time / 1.5f);
                text2CurrentColor      = Color.Lerp(Color.White, Color.Black, time / 1.5f);
                //startTextColor = Color.Lerp(Color.White, Color.Black, time / 1.5f);

                if (time > 1.8f)
                {
                    Game.ChangeScene(new GameScene(Game));
                }
                break;

            default:
                break;
            }
        }