Example #1
0
        //Land on the ground and dismount
        public bool Land(float z)
        {
            keyboard.KeyDown((int)Keyboard.Keys.VK_X);

            Thread t = new Thread(() => StuckThread.CallStuck(0));

            t.Start();

            bool isLanding = true;

            while (GameInfo.GetPlayerZ() > z + DROP_DISTANCE)
            {
                if (!isMoving)
                {
                    isLanding = false;
                    isMoving  = true;
                    t.Abort();
                    break;
                }
            }

            t.Abort();

            keyboard.KeyUp((int)Keyboard.Keys.VK_X);

            if (isLanding)
            {
                keyboard.KeyHold((int)Keyboard.Keys.VK_0, 1);
            }

            Thread.Sleep(1500);

            return(isLanding);
        }
Example #2
0
        public float MoveToPoint(Point target, float Max_Distance, float rotate)
        {
            Rotate(target, rotate);

            Point currentPos = GameInfo.GetPlayerPos();

            float distance      = GetDistance(currentPos, target);
            float init_distance = distance;
            float prev          = init_distance;

            keyboard.KeyDown((int)Keyboard.Keys.VK_UP);

            Thread t = new Thread(() => StuckThread.CallStuck(1));

            t.Start();

            while (true)
            {
                currentPos = GameInfo.GetPlayerPos();
                target     = new Point(target.getX(), target.getY());

                distance = GetDistance(currentPos, target);

                if (prev < distance)
                {
                    keyboard.KeyUp((int)Keyboard.Keys.VK_UP);
                    t.Abort();
                    return(distance);
                }

                prev = distance;

                //    Console.WriteLine(distance);

                if (distance < Max_Distance)
                {
                    keyboard.KeyUp((int)Keyboard.Keys.VK_UP);
                    t.Abort();
                    return(distance);
                }

                if (!isMoving)
                {
                    isMoving = true;
                    t.Abort();
                    return(-1);
                }
            }
        }
Example #3
0
        //Move the target up in the air along the Z-axis
        public void Lift(float z)
        {
            keyboard.KeyDown((int)Keyboard.Keys.VK_SPACE);

            Thread t = new Thread(() => StuckThread.CallStuck(0));

            t.Start();

            while (GameInfo.GetPlayerZ() < z)
            {
                if (!isMoving)
                {
                    isMoving = true;
                    t.Abort();
                    break;
                }
            }

            t.Abort();

            keyboard.KeyUp((int)Keyboard.Keys.VK_SPACE);
        }