Ejemplo n.º 1
0
 public virtual void FindSaveZone(Vector3 predatorPos)
 {
     variantsZones.Clear();
     finalZone = null;
     foreach (Transform zone in SaveZones)
     {
         if (Vector3.Angle(-Vec3Mathf.DirectionTo(transform.position, predatorPos), Vec3Mathf.DirectionTo(transform.position, zone.position)) < 130)
         {
             variantsZones.Add(zone);
         }
     }
     Transform[] variants = variantsZones.ToArray();
     if (variants.Length > 1)
     {
         ChooseZone(variants);
     }
     else
     {
         ChooseZone(SaveZones);
     }
 }
Ejemplo n.º 2
0
    void FindMouse()
    {
        int mousesInDir = 0;

        foreach (Transform mouse in mouseTrans)
        {
            Vector3 dir = Vec3Mathf.DirectionTo(transform.position, mouse.position);
            if (Vector3.Angle(transform.forward, dir) < 20)
            {
                mousesInDir++;
            }
        }
        if (mousesInDir > 0)
        {
            s_source.volume = 1;
        }
        else
        {
            s_source.volume = 0.3f;
        }
        //s_source.Play();
    }