Пример #1
0
        /// <summary>
        /// Handle input.
        /// </summary>
        /// <param name="input">The current state of input.</param>
        public override void HandleInput(InputState input)
        {
            // Call the base method.
            base.HandleInput(input);

            // If the player can't be controlled, end here.
            if (!_CanBeControlled) { return; }

            // Left, right, up, down and space.
            if (input.IsKeyDown(Keys.Left) && (_Body.Velocity.X > -_MaxSpeed)) { _Body.AddForce(new Vector3(-_Body.AccelerationValue, 0, 0)); }
            if (input.IsKeyDown(Keys.Right) && (_Body.Velocity.X < _MaxSpeed)) { _Body.AddForce(new Vector3(_Body.AccelerationValue, 0, 0)); }
            if (input.IsKeyDown(Keys.Up) && (_Body.Velocity.Y > -_MaxSpeed)) { _Body.AddForce(new Vector3(0, -_Body.AccelerationValue, 0)); }
            if (input.IsKeyDown(Keys.Down) && (_Body.Velocity.Y < _MaxSpeed)) { _Body.AddForce(new Vector3(0, _Body.AccelerationValue, 0)); }
            if (input.IsKeyDown(Keys.Space) && Math.Abs(_Body.Velocity.Z) < 1) { _Body.AddForce(new Vector3(0, 0, _Body.AccelerationValue)); }
        }
Пример #2
0
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            if (input.PauseGame)
            {
                // If they pressed pause, bring up the pause menu screen.
                ScreenManager.AddScreen(new PauseMenuScreen());
            }
            else
            {
                Battle.HandleInput(input);
            }
        }
Пример #3
0
 public void HandleInput(InputState input)
 {
     _BattleHUD.HandleInput(input);
 }
Пример #4
0
 public void HandleInput(InputState input)
 {
     TextBox.HandleInput(input);
 }
Пример #5
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public virtual void HandleInput(InputState input)
        {
            //Check if the menu is active.
            if (IsActive)
            {
                // Move to the previous menu entry?
                if (input.MenuUp)
                {
                    selectedEntry--;

                    if (selectedEntry < 0)
                        selectedEntry = menuEntries.Count - 1;
                }

                // Move to the next menu entry?
                if (input.MenuDown)
                {
                    selectedEntry++;

                    if (selectedEntry >= menuEntries.Count)
                        selectedEntry = 0;
                }

                // Move to the left menu entry?
                if (input.MenuLeft)
                {
                    selectedColumn--;

                    if (selectedColumn < 0) { selectedColumn = (menuEntries.Count - 1); }
                }

                // Move to the right menu entry?
                if (input.MenuRight)
                {
                    selectedColumn++;

                    if (selectedColumn > (menuEntries.Count - 1)) { selectedColumn = 0; }
                }

                // Accept or cancel the menu?
                if (input.MenuSelect)
                {
                    OnSelectEntry(selectedEntry);
                }
                else if (input.MenuCancel)
                {
                    OnCancel();
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            // Move to the previous menu entry?
            if (input.MenuUp)
            {
                selectedEntry--;

                if (selectedEntry < 0)
                    selectedEntry = menuEntries.Count - 1;
            }

            // Move to the next menu entry?
            if (input.MenuDown)
            {
                selectedEntry++;

                if (selectedEntry >= menuEntries.Count)
                    selectedEntry = 0;
            }

            // Accept or cancel the menu?
            if (input.MenuSelect)
            {
                OnSelectEntry(selectedEntry);
            }
            else if (input.MenuCancel)
            {
                OnCancel();
            }
        }
Пример #7
0
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            if (input == null) { throw new ArgumentNullException("input"); }

            if (input.PauseGame)
            {
                // If they pressed pause, bring up the pause menu screen.
                ScreenManager.AddScreen(new PauseMenuScreen());
            }
            else
            {
                //Let the scene handle input.
                _Scene.HandleInput(input);

                //Move the camera.
                if (input.IsKeyDown(Keys.A)) { _Camera.Move(new Vector2(-1, 0)); }
                else if (input.IsKeyDown(Keys.S)) { _Camera.Move(new Vector2(0, 1)); }
                else if (input.IsKeyDown(Keys.D)) { _Camera.Move(new Vector2(1, 0)); }
                else if (input.IsKeyDown(Keys.W)) { _Camera.Move(new Vector2(0, -1)); }

                //Zoom the camera.
                if (input.IsKeyDown(Keys.Z)) { _Camera.Zoom(.1f); }
                else if (input.IsKeyDown(Keys.X)) { _Camera.Zoom(-.1f); }
            }
        }
Пример #8
0
 //Handle all Input.
 public void HandleInput(InputState input)
 {
     //Handle The TextManager's Input.
     _TextManager.HandleInput(input);
 }
Пример #9
0
 public void HandleInput(InputState input)
 {
     _TextBox.HandleInput(input);
     _BattleMenu.HandleInput(input);
 }
Пример #10
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            //Move through the menu.
            base.HandleInput(input);

            //Update the Selecter's Position.
            _Sprite.SpritePosition[0, 1] =
                new Vector2(MenuEntries[SelectedColumn][SelectedEntry].Position.X - 1 +
                    (_Sprite.SpriteWidth[0, 1, 0] / 2), MenuEntries[SelectedColumn][SelectedEntry].Position.Y +
            (_Sprite.SpriteHeight[0, 1, 0] / 2) - 1);
        }
Пример #11
0
 /// <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 virtual void HandleInput(InputState input)
 {
 }
Пример #12
0
        /// <summary>
        /// Handle input.
        /// </summary>
        /// <param name="input">The current input state.</param>
        public void HandleInput(InputState input)
        {
            //Rotation.
            if (input.IsKeyDown(Keys.Left)) { _XRotation += _RotationSpeed; }
            if (input.IsKeyDown(Keys.Right)) { _XRotation += -_RotationSpeed; }
            if (input.IsKeyDown(Keys.Down)) { _YRotation += -_RotationSpeed; }
            if (input.IsKeyDown(Keys.Up)) { _YRotation += _RotationSpeed; }

            //Movement.
            if (input.IsKeyDown(Keys.W)) { MoveCamera(new Vector3(0, 0, -1)); }
            if (input.IsKeyDown(Keys.S)) { MoveCamera(new Vector3(0, 0, 1)); }
            if (input.IsKeyDown(Keys.A)) { MoveCamera(new Vector3(-1, 0, 0)); }
            if (input.IsKeyDown(Keys.D)) { MoveCamera(new Vector3(1, 0, 0)); }
            if (input.IsKeyDown(Keys.E)) { MoveCamera(new Vector3(0, 1, 0)); }
            if (input.IsKeyDown(Keys.Q)) { MoveCamera(new Vector3(0, -1, 0)); }

            //Camera speed.
            if (input.IsKeyDown(Keys.Space)) { _MoveSpeed = (_MoveSpeed == 10) ? 250 : 10; }
        }
Пример #13
0
        /// <summary>
        /// Responds to user input, accepting or cancelling the message box.
        /// </summary>
        public override void HandleInput(InputState input)
        {
            if (input.MenuSelect)
            {
                // Raise the accepted event, then exit the message box.
                if (Accepted != null)
                    Accepted(this, EventArgs.Empty);

                ExitScreen();
            }
            else if (input.MenuCancel)
            {
                // Raise the cancelled event, then exit the message box.
                if (Cancelled != null)
                    Cancelled(this, EventArgs.Empty);

                ExitScreen();
            }
        }
Пример #14
0
        //Handle all Input.
        public void HandleInput(InputState input)
        {
            //Check if it is waiting for user Input.
            if (_WaitForInput)
            {
                //Check for Input.
                if (input.MainSelect)
                {
                    //Check for what event should be happening.
                    switch (_TextBoxEvent)
                    {
                        case (TextBoxEvent.ClearTextBox):
                            {
                                //Clear the Text Box.
                                ClearTextBox();
                                //Exit.
                                break;
                            }
                        case (TextBoxEvent.ScrollRowsDown):
                            {
                                //Scroll the rows one step.
                                ScrollRows();
                                //Exit.
                                break;
                            }
                        case (TextBoxEvent.EndTextBox):
                            {
                                //Exit.
                                _Exit = true;
                                //Call the TextPrinted Event.
                                TextPrinted(this);

                                //Exit.
                                break;
                            }
                    }
                    //Disable the WaitForInput.
                    _WaitForInput = false;
                    //Reset the TextBoxEvent.
                    _TextBoxEvent = TextBoxEvent.None;
                }
            }
        }