Ejemplo n.º 1
0
 void Refresh()
 {
     if (activationStrategy == ActivationStrategy.OnlyClosestZone)
     {
         var newClosest = InfZone.ClosestZone(transform.position, zones);
         if (newClosest != closest)
         {
             if (closest)
             {
                 closest.Freeze();
             }
             newClosest.Unfreeze();
             closest = newClosest;
         }
     }
     else if (activationStrategy == ActivationStrategy.AllZonesWithinDistance)
     {
         foreach (var zone in zones)
         {
             float distance = Vector3.Distance(transform.position, zone.transform.position);
             if (distance < distanceThreshold)
             {
                 zone.Unfreeze();
             }
             else
             {
                 zone.Freeze();
             }
         }
     }
 }
Ejemplo n.º 2
0
 public void TransferToClosestZone()
 {
     TransferToZone(InfZone.ClosestZone(transform.position, zones));
 }