示例#1
0
    private void UpdateRequestedGradient()
    {
        Vector3 target = cursorController.GetTransform().position;

        //bool remainOnCurrentPath =false;
        if (target.x > car.transform.position.x)
        {
            Vector2 lastPoint = new Vector2(car.position.x, car.position.y);
            Vector2 lastDiff  = new Vector2(target.x, target.y) - lastPoint;

            requestedGradient = Mathf.Atan2(lastDiff.y, lastDiff.x);
        }
    }