コード例 #1
0
ファイル: HighscoreScreen.cs プロジェクト: trew/PoorJetX
        public override void HandleInput(Input input)
        {
            base.HandleInput(input);

            if (input.IsNewKeyPress(Keys.Enter))
            {
                ExitScreen();
            }
        }
コード例 #2
0
ファイル: ScoreScreen.cs プロジェクト: trew/PoorJetX
        public override void HandleInput(Input input)
        {
            base.HandleInput(input);

            if (input.IsNewKeyPress(Keys.Enter))
            {
                ExitScreen();
                ScreenManager.AddScreen(new BackgroundScreen());
                ScreenManager.AddScreen(new MainMenuScreen());
            }
        }
コード例 #3
0
ファイル: ControlsScreen.cs プロジェクト: trew/PoorJetX
        public override void HandleInput(Input input)
        {
            base.HandleInput(input);

            if (input.IsNewKeyPress(Keys.Enter)
                || input.IsNewKeyPress(Keys.Escape))
            {
                ScreenManager.RemoveScreen(this);
            }
        }
コード例 #4
0
ファイル: PlayerAirplane.cs プロジェクト: trew/PoorJetX
        public override void HandleDebugInput(Input input)
        {
            if (EngineManager.DebugKeysEnabled)
            {
                if (input.IsNewKeyPress(Keys.Y))
                {
                    TakeDamage(200);
                }

                if (input.CurrentKeyboardState.IsKeyDown(Keys.S))
                {
                    _thrust = 0;
                }

                if (input.IsNewKeyPress(Keys.O))
                {
                    ReadyToRender = !ReadyToRender;
                    CameraManager.Camera.Cruise();
                }
            }
        }
コード例 #5
0
ファイル: BriefingScreen.cs プロジェクト: trew/PoorJetX
        public override void HandleInput(Input input)
        {
            base.HandleInput(input);

            if (input.IsNewKeyPress(Keys.Enter))
            {
                ScreenManager.RemoveScreen(this);
                foreach (GameScreen screen in _screensToLoad)
                {
                    if (screen != null)
                    {
                        ScreenManager.AddScreen(screen);
                    }
                }
            }
        }
コード例 #6
0
ファイル: GamePlayScreen.cs プロジェクト: trew/PoorJetX
        /// <summary>
        /// Allows the screen to handle user input. Unlike Update, this method
        /// is only called when the screen is active, and not when some other
        /// screen has taken the focus.
        /// </summary>
        public override void HandleInput(Input input)
        {
            base.HandleInput(input);

            player1.HandleInput(input);

            /*
             *  DEBUG INPUT
             */
            #region
            if (EngineManager.DebugKeysEnabled)
            {
                if (input.IsNewKeyPress(Keys.D1))
                {
                    SceneGraphManager.SetTimeOfDay24h = 0f;
                }
                if (input.IsNewKeyPress(Keys.D2))
                {
                    SceneGraphManager.SetTimeOfDay24h = 3f;
                }
                if (input.IsNewKeyPress(Keys.D3))
                {
                    SceneGraphManager.SetTimeOfDay24h = 6f;
                }
                if (input.IsNewKeyPress(Keys.D4))
                {
                    SceneGraphManager.SetTimeOfDay24h = 9f;
                }
                if (input.IsNewKeyPress(Keys.D5))
                {
                    SceneGraphManager.SetTimeOfDay24h = 12f;
                }
                if (input.IsNewKeyPress(Keys.D6))
                {
                    SceneGraphManager.SetTimeOfDay24h = 15f;
                }
                if (input.IsNewKeyPress(Keys.D7))
                {
                    SceneGraphManager.SetTimeOfDay24h = 18f;
                }
                if (input.IsNewKeyPress(Keys.D8
                    ))
                {
                    SceneGraphManager.SetTimeOfDay24h = 21f;
                }

                if (input.IsNewKeyPress(Keys.E))
                {
                    GroundTransport gcv = new GroundTransport(3000, false);
                    gcv.Position = new Vector2(
                            CameraManager.Camera.Pos.X +
                            GameHelper.ScreenWidth - 200f,
                            GameHelper.GroundLevel - 38);
                    gcv.LoadContent();

                    SceneGraphManager.AddObject(gcv);
                }

                if (input.IsNewKeyPress(Keys.R))
                {
                    AntiAirVehicle gbv = new AntiAirVehicle(3000, false);
                    gbv.Position = new Vector2(
                            CameraManager.Camera.Pos.X +
                            GameHelper.ScreenWidth - 200f,
                            GameHelper.GroundLevel - 47);

                    gbv.Velocity = new Vector2(0f, 0f);
                    gbv.LoadContent();

                    SceneGraphManager.AddObject(gbv);
                }

                if (input.IsNewKeyPress(Keys.B))
                {
                    BossAntiAir boss = new BossAntiAir(70000, false);
                    boss.Position = new Vector2(
                            CameraManager.Camera.Pos.X +
                            GameHelper.ScreenWidth - 200f,
                            GameHelper.GroundLevel - 170);

                    boss.Velocity = new Vector2(0f, 0f);
                    boss.LoadContent();

                    SceneGraphManager.AddObject(boss);
                }
                if (input.IsNewKeyPress(Keys.N))
                {
                    GroundTransport boss = new GroundTransport(40000, false, true);
                    boss.Position = new Vector2(
                            CameraManager.Camera.Pos.X +
                            GameHelper.ScreenWidth - 200f,
                            GameHelper.GroundLevel - 130);

                    boss.Velocity = new Vector2(4f, 0f);
                    boss.LoadContent();

                    SceneGraphManager.AddObject(boss);
                }

                if (input.IsNewKeyPress(Keys.W))
                {
                    AmmoBase ab = new AmmoBase();
                    ab.Position = new Vector2(
                            CameraManager.Camera.Pos.X +
                            GameHelper.ScreenWidth - 250f,
                            GameHelper.GroundLevel + 10);
                    ab.LoadContent();

                    SceneGraphManager.AddObject(ab);
                }

                if (input.IsNewKeyPress(Keys.P))
                {
                    LevelManager.CurrentLevel.Completed = true;
                }

                if (input.IsNewKeyPress(Keys.F5))
                {
                    SceneGraphManager.ToggleCollisionDetection();
                }

                if (input.IsNewKeyPress(Keys.PageUp))
                {
                    ScreenManager.lengthenJanitorCoffeeBreak();
                }

                if (input.IsNewKeyPress(Keys.PageDown))
                {
                    ScreenManager.shortenJanitorCoffeeBreak();
                }

                if (input.IsNewKeyPress(Keys.Add))
                {
                    SceneGraphManager.TImeOfDaySpeed += 0.00001f;
                }

                if (input.IsNewKeyPress(Keys.Subtract))
                {
                    SceneGraphManager.TImeOfDaySpeed -= 0.00001f;
                }
            }
            #endregion
            /*
             *  END DEBUG INPUT
             */

            if (input.IsNewKeyPress(Keys.Escape))
            {
                SoundFxManager.Pause();
                PauseMenuScreen pauseMenuScreen = new PauseMenuScreen(400, 300);
                pauseMenuScreen.ExitToMenuEvent += ExitGameEvent;
                pauseMenuScreen.RestartGameEvent += RestartGameEvent;
                ScreenManager.AddScreen(pauseMenuScreen);
            }
            if (input.IsNewKeyPress(Keys.V))
            {
                GameSettings.Default.ShowUI = !GameSettings.Default.ShowUI;
            }
        }