示例#1
0
        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));
        }
示例#2
0
 private void OnDisable()
 {
     DarkZones.Unregister(this);
 }
示例#3
0
 private void OnDestroy()
 {
     DarkZones.Unregister(this);
 }
示例#4
0
 private void OnEnable()
 {
     DarkZones.Register(this);
 }