Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (!move.isPaused())
        {
            foreach (GameObject target in Targets)
            {
                SoundListener lis = target.GetComponentInChildren <SoundListener>();

                if (lis)
                {
                    Vector3 pos = target.transform.position;
                    pos.z = 0.0f;

                    Astar.ComputePath(pos, circle.radius, true);
                    float dis = Astar.GetPathDistance();

                    if (dis <= circle.radius)
                    {
                        lis.UpdateWaypoints(Astar.GetInvertedWaypoints());
                    }
                }
            }
        }
    }