Пример #1
0
        public ColliderDetector(
            Transform referenceFrame,
            int bufferSize,
            int layerMask,
            IEnumerable <string> tags,
            Rect lonLatRect,
            float minDistance,
            float maxDistance,
            float normalizationWeight,
            DistanceNormalization distanceNormalization,
            ColliderDetectionType detectionType,
            float scanResolution,
            float scanExtent,
            bool clearCache)
            : base(tags)
        {
            m_ReferenceFrame = referenceFrame;
            m_Buffer         = new Collider[bufferSize];
            m_LayerMask      = layerMask;
            m_LonLatRect     = lonLatRect;

            m_MinDistance    = minDistance;
            m_MinDistanceSqr = minDistance * minDistance;
            m_MaxDistance    = maxDistance;
            m_MaxDistanceSqr = maxDistance * maxDistance;

            m_DistanceRange       = maxDistance - minDistance;
            m_NormalizationWeight = normalizationWeight;
            m_ApplyWeight         = distanceNormalization == DistanceNormalization.Weighted;

            m_DetectClosest  = detectionType == ColliderDetectionType.ClosestPoint;
            m_DetectShape    = detectionType == ColliderDetectionType.Shape;
            m_ScanResolution = scanResolution;
            m_ScanExtent     = scanExtent;
            m_ClearCache     = clearCache;

            s_SharedColliderShapeCache.Clear();
        }
Пример #2
0
 public bool IsDetectableTag(string tag, out ColliderDetectionType detectionType)
 => m_DetectionTypes.TryGetValue(tag, out detectionType);