Пример #1
0
        static void Gizmo(SearchZone zone, GizmoType type)
        {
            var isSelected = (type & GizmoType.Selected) != 0;
            var alpha      = isSelected ? 0.8f : 0.4f;

            var collider = zone.GetComponent <BoxCollider>();

            if (collider != null)
            {
                var bounds = collider.bounds;

                Gizmos.color = new Color(0, 1, 0.6f, alpha);
                Gizmos.DrawCube(bounds.center, bounds.extents * 2);
            }
        }
Пример #2
0
        public void Reset(Vector3 observer, float maxDistance)
        {
            Items.Clear();

            foreach (var collider in Physics.OverlapSphere(observer, maxDistance, 1, QueryTriggerInteraction.Collide))
            {
                if (!collider.isTrigger)
                {
                    continue;
                }

                var block = SearchZone.Get(collider.gameObject);

                if (block != null)
                {
                    Items.Add(block);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Creates a list of search zones that are in the area surounding the observer.
        /// </summary>
        public void Reset(Vector3 observer, float maxDistance)
        {
            Items.Clear();
            var count = Physics.OverlapSphereNonAlloc(observer, maxDistance, Util.Colliders, Layers.Zones, QueryTriggerInteraction.Collide);

            for (int i = 0; i < count; i++)
            {
                var collider = Util.Colliders[i];

                if (!collider.isTrigger)
                {
                    continue;
                }

                var block = SearchZone.Get(collider.gameObject);

                if (block != null)
                {
                    Items.Add(block);
                }
            }
        }