예제 #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();
             }
         }
     }
 }
예제 #2
0
파일: InfActor.cs 프로젝트: eriksvedang/Inf
 public void TransferToClosestZone()
 {
     TransferToZone(InfZone.ClosestZone(transform.position, zones));
 }