コード例 #1
0
        private void Debug(string x)
        {
            var Client         = GetGridClient();
            var ClientMovement = Client.Self.Movement;

            // return; /* remove for debugging */
            TheBot.Debug(x + " {0,3:##0} {1,3:##0} {2,3:##0} diff {3,5:##0.0} olddiff {4,5:##0.0}  At:{5,5} {6,5}  Up:{7,5} {8,5}  v: {9} w: {10}",
                         myPos.X, myPos.Y, myPos.Z, diff, saveolddiff,
                         ClientMovement.AtPos, ClientMovement.AtNeg, ClientMovement.UpPos, ClientMovement.UpNeg,
                         Client.Self.Velocity.ToString(), Client.Self.AngularVelocity.ToString());
        }
コード例 #2
0
        public bool FlyToOnce()
        {
            // startTime = 10000;
            try
            {
                var      Client   = GetGridClient();
                double   dist     = ((SimMover)TheBot).Distance(Target);
                Vector3d premoved = TheBot.GlobalPosition;
                if (dist > maxDistance)
                {
                    //ClientMovement.Fly = true;
                    //KeepFollowing = true;
                    //ClientMovement.AtPos = true;
                    //startTime = 10000;
                    if (DoZ)
                    {
                        Client.Self.Movement.AtPos = false;
                        //if (startTime + 30000 > Environment.TickCount)
                        {
                            DoZ = false;
                            XYMovement();
                            target0.X = (float)target.X;
                            target0.Y = (float)target.Y;
                            //Client.Objects.OnObjectUpdated -= callback;
                            RegCallback();
                            SetMovement();
                        }
                    }
                    else
                    {
                        if (startTime.AddMinutes(1) > DateTime.Now)
                        {
                            DoZ = true;
                        }
                    }
                    Thread.Sleep(2000);
                    double premovedDist = Vector3d.Distance(premoved, TheBot.GlobalPosition);
                    if (premovedDist < 1)
                    {
                        blockedTimes++;
                        if (blockedTimes < 5)
                        {
                            return(true);
                        }
                        blockedTimes  = 0;
                        KeepFollowing = false;
                        TheBot.Debug("Blocked only moved " + premovedDist);
                        return(false);
                    }
                    //DoZ = !DoZ;
                    //if (DoZ) ZMovement();
                    //ClientMovement.TurnToward(target);
                    //System.Threading.Thread.Sleep(100);

                    //if (!DoZ) XYMovement();
                    //  ClientMovement.AtPos = false;
                    //   ClientMovement.AtNeg = false;
                    //  ZMovement();
                    //   ClientMovement.SendUpdate(false);
                    return(true);
                }
                else
                {
                    DoZ = true;
                    EndFlyto();
                    TheBot.TurnToward(Target.GlobalPosition);
                    //Thread.Sleep(1000); // total 3 seconds
                    return(false);
                }
            }
            finally
            {
                if (false)
                {
                    DeRegCallback();
                }
            }
        }