public void Repath()
    {
        if (this.tileMoveable.CurrentPath != null)
        {
            DiscreteSpeedMoveable discreteMoveable = tileMoveable.GetComponent <DiscreteSpeedMoveable>();

            finalPath = null;
            bool bCouldUpdatePath = false;
            bool bNeedRepath      = false;

            if (this.tileMoveable.transform.position == this.transform.position &&
                this.tileMoveable.transform.forward == this.transform.forward &&
                discreteMoveable.currentSpeed == tileMoveable.CurrentPath.speed)
            {
                bNeedRepath = false;
            }
            else
            {
                bNeedRepath = true;
                if (this.tileMoveable.CurrentPath.isDirectional)
                {
                    // Directional search
                    bCouldUpdatePath
                        = FindPathAtCurrentSpeed(this.transform.position, this.tileMoveable.CurrentPath.GetEndDirectionVec3(), out finalPath);
                }
                else
                {
                    // Non-Directional search
                    bCouldUpdatePath
                        = FindPathAtCurrentSpeed(this.transform.position, out finalPath);
                }
            }

            if (bNeedRepath)
            {
                if (!bCouldUpdatePath)
                {
                    SetPositionAndDirection(this.tileMoveable.transform.position, this.tileMoveable.transform.forward);
                }
                else
                {
                    SetPositionAndDirection(this.transform.position, finalPath.GetEndDirectionVec3());
                }
            }

            this.tileMoveable.CurrentPath = finalPath;
            this.UpdatePathLines();
        }
    }
    public void OnPointerDown(PointerEventData eventData)
    {
        draggingHasOccured = false;
        if (this.tileMoveable != null)
        {
            if (eventData.pointerId == kLeftMouse)
            {
                RaycastHit hitInfo;
                Ray        ray = Camera.main.ScreenPointToRay(eventData.pressPosition);
                if (ghostCollider.Raycast(ray, out hitInfo, 1000.0f))
                {
                    moveMode         = eWidgetMode.Translate;
                    wasDownOnControl = true;
                }
                // TODO: Clean this up
                else if (Physics.Raycast(ray, out hitInfo, 1000.0f, widgetLayer))
                {
                    if (string.Compare(hitInfo.transform.tag, "Sphere") == 0)
                    {
                        moveMode = eWidgetMode.Translate;
                    }
                    else
                    {
                        moveMode = eWidgetMode.Rotate;
                    }

                    wasDownOnControl = true;
                }
            }
            else if (eventData.pointerId == kRightMouse)
            {
                RaycastHit hitInfo;
                Ray        ray = Camera.main.ScreenPointToRay(eventData.position);

                if (Physics.Raycast(ray, out hitInfo, 1000.0f, terrainLayer))
                {
                    if (Vector3.SqrMagnitude(hitInfo.point - this.transform.position) < Granularity)
                    {
                        return;
                    }

                    // experimenting with 'best' path
                    //if (FindBestPath(hitInfo.point, out finalPath))
                    if (FindPathAtCurrentSpeed(hitInfo.point, out finalPath))
                    {
                        SetPositionAndDirection(hitInfo.point, finalPath.GetEndDirectionVec3());

                        this.tileMoveable.CurrentPath = finalPath;

                        this.UpdatePathLines();

                        //well, it's technically true, since we teleported the widget to our mouse
                        wasDownOnControl = true;
                        moveMode         = eWidgetMode.Rotate;

                        pathStartedAsReverse = finalPath.isReverse;
                    }
                }
            }
        }
    }