public static float GetViewDistance(Vector3 position, float viewDistance, bool isAlerted) { var count = Physics.OverlapSphereNonAlloc(position, 1, _colliders, 0x1 << 8, QueryTriggerInteraction.Collide); _dark.Clear(); _light.Clear(); _grass.Clear(); for (int i = 0; i < count; i++) { { var zone = DarkZones.Get(_colliders[i].gameObject); if (zone != null) { _dark.Add(zone); } } { var zone = LightZones.Get(_colliders[i].gameObject); if (zone != null) { _light.Add(zone); } } { var zone = GrassZones.Get(_colliders[i].gameObject); if (zone != null) { _grass.Add(zone); } } } return(GetViewDistance(viewDistance, _dark, _light, _grass, isAlerted)); }
private void OnDisable() { DarkZones.Unregister(this); }
private void OnDestroy() { DarkZones.Unregister(this); }
private void OnEnable() { DarkZones.Register(this); }