Esempio n. 1
0
        public bool IsIntersect(ColliderGroup colliderGroup2, List <ColliderType> checkColliderTypeList1,
                                List <ColliderType> checkColliderTypeList2)
        {
            _tmpToCheckColliderList1.Clear();
            _tmpToCheckColliderList2.Clear();

            for (var i = 0; i < checkColliderTypeList1.Count; i++)
            {
                var colliderType = checkColliderTypeList1[i];
                _tmpToCheckColliderList1.AddRange(colliderListDict[colliderType]);
            }

            for (var i = 0; i < checkColliderTypeList2.Count; i++)
            {
                var colliderType = checkColliderTypeList2[i];
                _tmpToCheckColliderList2.AddRange(colliderGroup2.colliderListDict[colliderType]);
            }

            for (var i = 0; i < _tmpToCheckColliderList1.Count; i++)
            {
                var collider1 = _tmpToCheckColliderList1[i];
                for (var j = 0; j < _tmpToCheckColliderList2.Count; j++)
                {
                    var collider2 = _tmpToCheckColliderList2[j];
                    if (collider1.IsIntersect(collider2))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 2
0
        public bool IsIntersect(ColliderGroup colliderGroup2, ColliderType checkColliderType1,
                                ColliderType checkColliderType2)
        {
            _tmpCheckColliderTypeList1.Clear();
            _tmpCheckColliderTypeList1.Add(checkColliderType1);

            _tmpCheckColliderTypeList_2.Clear();
            _tmpCheckColliderTypeList_2.Add(checkColliderType2);

            return(IsIntersect(colliderGroup2, _tmpCheckColliderTypeList1, _tmpCheckColliderTypeList_2));
        }