예제 #1
0
    void ManualMovementOrder(Vector3 nowLocation)
    {
        //Set up an anchor
        Transform anchor = new GameObject().transform;

        anchor.position = (nowLocation + downLocation) / 2;

        Vector3 vDir   = nowLocation - downLocation;
        float   yAngle = Vector3.SignedAngle(Vector3.forward, vDir, Vector3.up) - 90;

        anchor.rotation = Quaternion.Euler(0, yAngle, 0);



        previewing = false;
        for (int i = 0; i < TPV.Length; i++)
        {
            TPV [i].SetActive(false);
        }

        goalDirection     = anchor.rotation.eulerAngles;
        goalLocation      = anchor.position;
        goalWidth         = Mathf.Clamp(Mathf.FloorToInt(Vector3.Distance(nowLocation, downLocation) / myFormation.spacing), 4, 14);
        myFormation.width = goalWidth;

        var newShape = myFormation.GetStandardSpots(anchor.position, anchor.forward, anchor.right, goalWidth);

        myFormation.ChangeShape(myFormation.line, newShape);

        NMA.SetDestination(goalLocation);
    }