MrGravity.Game_Objects.Physics_Objects.Player.Update C# (CSharp) Метод

Update() публичный Метод

Updates the player location and the player controls
public Update ( GameTime gametime ) : void
gametime Microsoft.Xna.Framework.GameTime The current Gametime
Результат void
        public override void Update(GameTime gametime)
        {
            base.Update(gametime);

            if (_mRumble)
                StopRumble();

            if (Math.Abs(Velocity.X) >= 15 || Math.Abs(Velocity.Y) >= 15)
                MCurrentTexture = PlayerFaces.FromString("Surprise");
            else if (!_mRumble)
                MCurrentTexture = CheckForIdle();

            //SHIFT: Down
            if ((_mControls.IsAPressed(false) || _mControls.IsDownPressed(false)) && MEnvironment.GravityDirection != GravityDirections.Down)
            {
                GameSound.LevelGravityShiftDown.Play(GameSound.Volume * 0.75f, 0.0f, 0.0f);
                MEnvironment.GravityDirection = GravityDirections.Down;
                _mGoalRotation = _mRotationDown;
                _mRotationFactor = 0.0f;
                SetFaceStraight();
            }

            //SHIFT: Up
            else if ((_mControls.IsYPressed(false) || _mControls.IsUpPressed(false)) && MEnvironment.GravityDirection != GravityDirections.Up)
            {
                GameSound.LevelGravityShiftUp.Play(GameSound.Volume * 0.75f, 0.0f, 0.0f);
                MEnvironment.GravityDirection = GravityDirections.Up;
                _mRotationFactor = 0.0f;
                SetFaceStraight();
            }

            //SHIFT: Left
            else if ((_mControls.IsXPressed(false) || _mControls.IsLeftPressed(false)) && MEnvironment.GravityDirection != GravityDirections.Left)
            {
                GameSound.LevelGravityShiftLeft.Play(GameSound.Volume * 0.75f, 0.0f, 0.0f);
                MEnvironment.GravityDirection = GravityDirections.Left;
                _mRotationFactor = (float)(-Math.PI / 60.0f);
                _mFaceGoalRotation = _mFaceRotationLeft;
            }

            //SHIFT: Right
            else if ((_mControls.IsBPressed(false) || _mControls.IsRightPressed(false)) && MEnvironment.GravityDirection != GravityDirections.Right)
            {
                GameSound.LevelGravityShiftRight.Play(GameSound.Volume * 0.75f, 0.0f, 0.0f);
                MEnvironment.GravityDirection = GravityDirections.Right;
                _mRotationFactor = (float)(Math.PI / 60.0f);
                _mFaceGoalRotation = _mFaceRotationRight;
            }

            if (Math.Abs(_mRotation) > 2.0 * Math.PI)
            {
                _mRotation -= (float)(2.0 * Math.PI);
            }
            else if (Math.Abs(_mRotation) < -2.0 * Math.PI)
            {
                _mRotation += (float)(2.0 * Math.PI);
            }

            _mRotation += _mRotationFactor;

            if (Math.Abs(_mFaceGoalRotation - _mFaceRotation) < 0.1)
            {
                _mFaceRotation = _mFaceGoalRotation;
            }
            else if (_mFaceRotation > _mFaceGoalRotation)
            {
                _mFaceRotation -= _mFaceRotationFactor;
            }
            else
            {
                _mFaceRotation += _mFaceRotationFactor;
            }
        }