示例#1
0
        //---------------------------------------------------------------------------------------------

        private void UpdatePositionAndDirection()
        {
            if (this.StatusType != StatusType.Player)
            {
                string sufix    = "-";
                double distance = 0;

                if (mobile.ExistCust() && mobile.Hits > -1)
                {
                    lastPositon = mobile.GetPosition();
                }

                distance          = Robot.GetRealDistance(World.Player.GetPosition(), lastPositon);
                lastPositionAngle = Robot.GetAngle(World.Player.GetPosition(), lastPositon);

                MovementDirection direction = Robot.GetMovementDirection(lastPositionAngle);
                if (direction == MovementDirection.Up)
                {
                    sufix = "↑";
                }
                else if (direction == MovementDirection.UpRight)
                {
                    sufix = "↗";
                }
                else if (direction == MovementDirection.Right)
                {
                    sufix = "→";
                }
                else if (direction == MovementDirection.DownRight)
                {
                    sufix = "↘";
                }
                else if (direction == MovementDirection.Down)
                {
                    sufix = "↓";
                }
                else if (direction == MovementDirection.DownLeft)
                {
                    sufix = "↙";
                }
                else if (direction == MovementDirection.Left)
                {
                    sufix = "←";
                }
                else if (direction == MovementDirection.UpLeft)
                {
                    sufix = "↖";
                }

                Color c = Color.Transparent;

                if (distance <= 1)
                {
                    c = Color.FromArgb(0, 128, 255);
                }
                else if (distance <= 5)
                {
                    c = Color.FromArgb(0, 191, 255);
                }
                else if (distance <= 10)
                {
                    c = Color.FromArgb(0, 255, 255);
                }
                else if (distance <= 15)
                {
                    c = Color.FromArgb(0, 255, 191);
                }
                else if (distance > 15)
                {
                    c = Color.FromArgb(0, 255, 128);
                }


                this.runLabel.BackColor = c;

                if (distance > 99 || distance < 0)
                {
                    distance = 0;
                }

                //-/|\---↖↗↘↙↑← →↓
                string runLabelText = String.Format("{0:N0}", distance);
                runLabelText      += " " + sufix;
                this.runLabel.Text = runLabelText;
                this.runLabel.Invalidate();
            }
        }