BolterLibrary.Navigation.Walk C# (CSharp) Method

Walk() public method

public Walk ( float x, float y, bool KeepWalking ) : void
x float
y float
KeepWalking bool
return void
        public void Walk(float x, float y, bool KeepWalking)
        {
            if (Moving)
                return;
            Moving = true;

            HaltFlag = false;
            float heading;
            float tobeHeading;
            var waypoint = new D3DXVECTOR2(x, y);
            if (CorDelay)
                Funcs.SetMoveStatus(WalkingStatus.Standing);

            ModelRotation(waypoint);

            if (CamReset)
                SendKeyPress(KeyStates.Toggled, Key.End);

            if (CorDelay)
                Thread.Sleep(HeadToll);

            var decX = (Funcs.GetPOS(EntityType.PCMob, Axis.X, 0) > x);

            Funcs.SetMoveStatus(WalkingStatus.Autorun | WalkingStatus.Running);

            if (decX)
            {
                while (Funcs.GetPOS(EntityType.PCMob, Axis.X, 0) > x)
                {
                    if (HaltFlag)
                    {
                        Funcs.SetMoveStatus(WalkingStatus.Standing);
                        Moving = false;
                        return;
                    }
                    if (AICorrection)
                    {
                        heading = Funcs.GetHeading(EntityType.PCMob, 0);

                        tobeHeading = HeadingToRad(AllEntities.Get2DPos(), waypoint);

                        // Check if our heading is within our tolerance.
                        if (tobeHeading - heading < 0 ? tobeHeading - heading < -0.1f : tobeHeading - heading > 0.1f)
                            ModelRotation(waypoint);
                    }
                    Thread.Sleep(10);
                }
            }
            else
            {
                while (Funcs.GetPOS(EntityType.PCMob, Axis.X, 0) < x)
                {
                    if (HaltFlag)
                    {
                        Funcs.SetMoveStatus(WalkingStatus.Standing);
                        Moving = false;
                        return;
                    }
                    if (AICorrection)
                    {
                        heading = Funcs.GetHeading(EntityType.PCMob, 0);
                        tobeHeading = HeadingToRad(AllEntities.Get2DPos(), waypoint);

                        // Check if our heading is within our tolerance.
                        if (tobeHeading - heading < 0 ? tobeHeading - heading < -0.1f : tobeHeading - heading > 0.1f)
                            ModelRotation(waypoint);
                    }
                    Thread.Sleep(10);
                }
            }
            if (!KeepWalking)
                Funcs.SetMoveStatus(WalkingStatus.Standing);
            Moving = false;
        }