Terraria.Mount.Hover C# (CSharp) Method

Hover() public method

public Hover ( Player mountedPlayer ) : bool
mountedPlayer Player
return bool
        public bool Hover(Player mountedPlayer)
        {
            if (this._frameState == 2 || this._frameState == 4)
            {
                bool flag = true;
                float num1 = 1f;
                float num2 = mountedPlayer.gravity / Player.defaultGravity;
                if (mountedPlayer.slowFall)
                    num2 /= 3f;
                if ((double)num2 < 0.25)
                    num2 = 0.25f;
                if (this._type != 7 && this._type != 8 && this._type != 12)
                {
                    if (this._flyTime > 0)
                        --this._flyTime;
                    else if ((double)this._fatigue < (double)this._fatigueMax)
                        this._fatigue += num2;
                    else
                        flag = false;
                }
                if (this._type == 12 && !mountedPlayer.MountFishronSpecial)
                    num1 = 0.5f;
                float num3 = this._fatigue / this._fatigueMax;
                if (this._type == 7 || this._type == 8 || this._type == 12)
                    num3 = 0.0f;
                float num4 = 4f * num3;
                float num5 = 4f * num3;
                if ((double)num4 == 0.0)
                    num4 = -1.0f / 1000.0f;
                if ((double)num5 == 0.0)
                    num5 = -1.0f / 1000.0f;
                float num6 = mountedPlayer.velocity.Y;
                if ((mountedPlayer.controlUp || mountedPlayer.controlJump) && flag)
                {
                    num4 = (float)(-2.0 - 6.0 * (1.0 - (double)num3));
                    num6 -= this._data.acceleration * num1;
                }
                else if (mountedPlayer.controlDown)
                {
                    num6 += this._data.acceleration * num1;
                    num5 = 8f;
                }
                else
                {
                    int num7 = mountedPlayer.jump;
                }
                if ((double)num6 < (double)num4)
                {
                    if ((double)num4 - (double)num6 < (double)this._data.acceleration)
                        num6 = num4;
                    else
                        num6 += this._data.acceleration * num1;
                }
                else if ((double)num6 > (double)num5)
                {
                    if ((double)num6 - (double)num5 < (double)this._data.acceleration)
                        num6 = num5;
                    else
                        num6 -= this._data.acceleration * num1;
                }
                mountedPlayer.velocity.Y = num6;
                mountedPlayer.fallStart = (int)((double)mountedPlayer.position.Y / 16.0);
            }
            else if (this._type != 7 && this._type != 8 && this._type != 12)
                mountedPlayer.velocity.Y += mountedPlayer.gravity * mountedPlayer.gravDir;
            else if ((double)mountedPlayer.velocity.Y == 0.0)
                mountedPlayer.velocity.Y = 1.0f / 1000.0f;
            if (this._type == 7)
            {
                float num1 = mountedPlayer.velocity.X / this._data.dashSpeed;
                if ((double)num1 > 0.95)
                    num1 = 0.95f;
                if ((double)num1 < -0.95)
                    num1 = -0.95f;
                float num2 = (float)(0.785398185253143 * (double)num1 / 2.0);
                float num3 = Math.Abs((float)(2.0 - (double)this._frame / 2.0)) / 2f;
                Lighting.AddLight((int)((double)mountedPlayer.position.X + (double)(mountedPlayer.width / 2)) / 16, (int)((double)mountedPlayer.position.Y + (double)(mountedPlayer.height / 2)) / 16, 0.4f, 0.2f * num3, 0.0f);
                mountedPlayer.fullRotation = num2;
            }
            else if (this._type == 8)
            {
                float num1 = mountedPlayer.velocity.X / this._data.dashSpeed;
                if ((double)num1 > 0.95)
                    num1 = 0.95f;
                if ((double)num1 < -0.95)
                    num1 = -0.95f;
                float num2 = (float)(0.785398185253143 * (double)num1 / 2.0);
                mountedPlayer.fullRotation = num2;
                Mount.DrillMountData drillMountData = (Mount.DrillMountData)this._mountSpecificData;
                float num3 = drillMountData.outerRingRotation + mountedPlayer.velocity.X / 80f;
                if ((double)num3 > 3.14159274101257)
                    num3 -= 6.283185f;
                else if ((double)num3 < -3.14159274101257)
                    num3 += 6.283185f;
                drillMountData.outerRingRotation = num3;
            }
            return true;
        }