Пример #1
0
    private static void _Encapsulate(SECTR_Sector newSector, List <Transform> rootTransforms, List <Bounds> rootBounds, string undoString)
    {
        int numRoots = rootTransforms.Count;

        for (int rootIndex = numRoots - 1; rootIndex >= 0; --rootIndex)
        {
            Transform rootTransform = rootTransforms[rootIndex];
            if (rootTransform != newSector.transform && SECTR_Geometry.BoundsContainsBounds(newSector.TotalBounds, rootBounds[rootIndex]))
            {
                SECTR_Undo.Parent(newSector.gameObject, rootTransform.gameObject, undoString);
                rootTransforms.RemoveAt(rootIndex);
                rootBounds.RemoveAt(rootIndex);
            }
        }
    }
    public List <SECTR_Member.Child> GetSharedChildren()
    {
        List <SECTR_Member.Child> sharedChildren     = new List <SECTR_Member.Child>();
        List <SECTR_Sector>       overlappingSectors = new List <SECTR_Sector>();
        int numChildren = Children.Count;

        for (int childIndex = 0; childIndex < numChildren; ++childIndex)
        {
            SECTR_Member.Child child = Children[childIndex];
            if (child.renderer && !SECTR_Geometry.BoundsContainsBounds(TotalBounds, child.rendererBounds))
            {
                GetContaining(ref overlappingSectors, child.rendererBounds);
                if (overlappingSectors.Count > 1)
                {
                    sharedChildren.Add(child);
                    continue;
                }
            }
            if (child.light && !SECTR_Geometry.BoundsContainsBounds(TotalBounds, child.lightBounds))
            {
                GetContaining(ref overlappingSectors, child.lightBounds);
                if (overlappingSectors.Count > 1)
                {
                    sharedChildren.Add(child);
                    continue;
                }
            }
            if (child.terrain && !SECTR_Geometry.BoundsContainsBounds(TotalBounds, child.terrainBounds))
            {
                GetContaining(ref overlappingSectors, child.terrainBounds);
                if (overlappingSectors.Count > 1)
                {
                    sharedChildren.Add(child);
                    continue;
                }
            }
        }
        return(sharedChildren);
    }