示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (gameManager.isGameActive)
        {
            Ray     ray        = Camera.main.ScreenPointToRay(Input.mousePosition);
            Vector3 mousePoint = new Vector3(ray.origin.x, ray.origin.y);
            Vector3 target     = mousePoint.normalized * orbitHeight;

            if (status == SquareStatuses.NAVIGATING)
            {
                transform.position = Vector3.Lerp(transform.position, target, speed * Time.deltaTime);

                if (Vector3.Distance(transform.position, gameManager.center) < orbitHeight + 0.1f)
                {
                    status = SquareStatuses.ON_ORBIT;
                }
            }
            else if (status == SquareStatuses.ON_ORBIT)
            {
                Vector3 curPosition = transform.position - gameManager.center;

                var newRotation = new Quaternion();
                newRotation.SetFromToRotation(curPosition, target);
                Vector3 newPosition = Quaternion.Lerp(transform.rotation, newRotation, orbitSpeed * Time.deltaTime) * transform.position;
                transform.position = new Vector3(newPosition.x, newPosition.y, 0);
            }
        }
    }
    public override string ToString()
    {
        var  sb      = new StringBuilder("SearchSquaresResponse(");
        bool __first = true;

        if (Squares != null && __isset.squares)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Squares: ");
            Squares.ToString(sb);
        }
        if (SquareStatuses != null && __isset.squareStatuses)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SquareStatuses: ");
            SquareStatuses.ToString(sb);
        }
        if (MyMemberships != null && __isset.myMemberships)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("MyMemberships: ");
            MyMemberships.ToString(sb);
        }
        if (ContinuationToken != null && __isset.continuationToken)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ContinuationToken: ");
            ContinuationToken.ToString(sb);
        }
        if (NoteStatuses != null && __isset.noteStatuses)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("NoteStatuses: ");
            NoteStatuses.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }