Example #1
0
    // Update is called once per frame
    void Update()
    {
        direction = target.transform.position - agent.transform.position;

        if (direction.magnitude == 0)
        {
            return;
        }

        GameObject go        = new GameObject();
        Agent      newTarget = go.AddComponent <Agent>() as Agent;

        newTarget.transform.position = target.transform.position;
        rotationVector            = new Vector3(0, 0, (float)Math.Atan2(-direction.x, direction.y));
        target.transform.rotation = Quaternion.Euler(rotationVector);

        target = newTarget;

        align.doYourThing();
    }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     align.doYourThing();
 }