Exemple #1
0
        public void RotateAim(Aim aim, Player.Side side)
        {
            if (currentKeyboardState.IsKeyDown(upKey))
            {
                aim.Rotate((int)1);
            }
            else if (currentKeyboardState.IsKeyDown(downKey))
            {
                aim.Rotate((int)-1);
            }

            aim.angle = aim.DegreeToRadian(aim.angleInDegrees);
        }
Exemple #2
0
        public void RotateAim(Aim aim, Player.Side side)
        {
            float rightThumbstickY = currentGamePadState.ThumbSticks.Right.Y;
            float rightThumbstickX = currentGamePadState.ThumbSticks.Right.X;

            if ((rightThumbstickX != 0 || rightThumbstickY != 0))
            {
                float thumbstickAngle = 0;

                float thumbstickAngleAngleInDegrees = 0;

                thumbstickAngle = (float)Math.Atan2(rightThumbstickY, rightThumbstickX);

                thumbstickAngleAngleInDegrees = (float)aim.RadianToDegree(thumbstickAngle);

                if (side == Player.Side.Left)
                {
                    if (thumbstickAngleAngleInDegrees >= 0)
                    {
                        thumbstickAngleAngleInDegrees = 90 - (thumbstickAngleAngleInDegrees - 90);
                    }
                    else
                    {
                        thumbstickAngleAngleInDegrees = -90 + ((thumbstickAngleAngleInDegrees + 90) * -1);
                    }
                }

                aim.Rotate(thumbstickAngleAngleInDegrees);
            }

            aim.angle = aim.DegreeToRadian(aim.angleInDegrees);
        }
Exemple #3
0
        public void RotateAim(Aim aim, Player.Side side)
        {
            if (currentMouseState.Position != previousMouseState.Position)
            {
                if (currentMouseState.Position.Y < aim.mouseAimArea.Y - (aim.mouseAimArea.Height / 2))
                {
                    aim.Rotate((int)1);
                }
                else if (currentMouseState.Position.Y > aim.mouseAimArea.Y - (aim.mouseAimArea.Height / 2))
                {
                    aim.Rotate((int)-1);
                }
            }

            aim.angle = aim.DegreeToRadian(aim.angleInDegrees);
        }