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(); } } } }
public void TransferToClosestZone() { TransferToZone(InfZone.ClosestZone(transform.position, zones)); }