コード例 #1
0
        public override void Update(ContentManager content, GameTime gameTime)
        {
            if (isLoaded == false)
            {
                isLoaded = true;
                font     = content.Load <SpriteFont>("ps2p");
            }

            if (game.AllowInput == true)
            {
                if (showControls == false)
                {
                    if (Keyboard.GetState().IsKeyDown(Keys.Down))
                    {
                        switch (mc)
                        {
                        case menuCursor._continue:
                            mc = menuCursor._options;
                            break;

                        case menuCursor._options:
                            mc = menuCursor._controls;
                            break;

                        case menuCursor._controls:
                            mc = menuCursor._exit;
                            break;

                        case menuCursor._exit:
                            mc = menuCursor._continue;
                            break;
                        }
                        game.ResetInputTimer();
                    }

                    if (Keyboard.GetState().IsKeyDown(Keys.Up))
                    {
                        switch (mc)
                        {
                        case menuCursor._continue:
                            mc = menuCursor._exit;
                            break;

                        case menuCursor._options:
                            mc = menuCursor._continue;
                            break;

                        case menuCursor._controls:
                            mc = menuCursor._options;
                            break;

                        case menuCursor._exit:
                            mc = menuCursor._controls;
                            break;
                        }
                        game.ResetInputTimer();
                    }

                    if (mc == menuCursor._continue && Keyboard.GetState().IsKeyDown(Keys.Enter))
                    {
                        game.ResetInputTimer();
                        AIE.StateManager.PopState();
                    }

                    if (mc == menuCursor._options && Keyboard.GetState().IsKeyDown(Keys.Enter))
                    {
                        game.ResetInputTimer();
                        AIE.StateManager.ChangeState("OptionsState");
                    }

                    if (mc == menuCursor._exit && Keyboard.GetState().IsKeyDown(Keys.Enter))
                    {
                        game.Exit();
                    }
                }

                if (mc == menuCursor._controls && Keyboard.GetState().IsKeyDown(Keys.Enter))
                {
                    if (showControls == false)
                    {
                        showControls = true;
                        game.ResetInputTimer();
                    }
                    else
                    {
                        showControls = false;
                        game.ResetInputTimer();
                    }
                }
            }
        }
コード例 #2
0
        public override void Update(ContentManager content, GameTime gameTime)
        {
            if (isLoaded == false)
            {
                isLoaded    = true;
                ps2p        = content.Load <SpriteFont>("ps2p");
                font04b     = content.Load <SpriteFont>("funsize");
                kitty       = content.Load <Texture2D>("jett_run_x1000");
                grass       = content.Load <Texture2D>("grass");
                aniTimer    = 0;
                runTimer    = 0;
                rotateTimer = 0;
            }
            float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            aniTimer    += deltaTime;
            runTimer    += deltaTime * 4;
            rotateTimer += deltaTime * 1.5f;

            if (aniTimer > 1)
            {
                aniTimer = 0;
            }
            if (runTimer > 1)
            {
                runTimer = 0;
            }
            if (rotateTimer > 360)
            {
                rotateTimer = 0;
            }

            if (game.AllowInput == true)
            {
                if (start == true)
                {
                    if (Keyboard.GetState().IsKeyDown(Keys.Enter) == true)
                    {
                        AIE.StateManager.ChangeState("IntroCutscene");
                        game.ResetInputTimer();
                        CleanUp();
                    }
                    if ((Keyboard.GetState().IsKeyDown(Keys.Down) || Keyboard.GetState().IsKeyDown(Keys.Up)))
                    {
                        start = false;
                        game.ResetInputTimer();
                    }
                }
                else
                {
                    if (Keyboard.GetState().IsKeyDown(Keys.Enter) == true)
                    {
                        game.Exit();
                    }
                    if ((Keyboard.GetState().IsKeyDown(Keys.Down) || Keyboard.GetState().IsKeyDown(Keys.Up)))
                    {
                        start = true;
                        game.ResetInputTimer();
                    }
                }
            }
        }