Exemple #1
0
    public static void DestorySon(Transform trans, IncludeOrExcept wInOrEx, string str)
    {
        List <Transform> sons = trans.GetSonS();

        foreach (Transform son in sons)
        {
            if (wInOrEx == IncludeOrExcept.except && !son.name.Contains(str))
            {
                GameObject.Destroy(son.gameObject);
            }
            else if (wInOrEx == IncludeOrExcept.include && son.name.Contains(str))
            {
                GameObject.Destroy(son.gameObject);
            }
        }
    }
Exemple #2
0
    public static void DestorySunzi(Transform trans, IncludeOrExcept wInOrEx, string str)
    {
        List <Transform> sons = trans.GetSonS();

        foreach (Transform son in sons)
        {
            if (son.childCount == 0)
            {
                continue;
            }
            foreach (Transform sunzi in son.GetSonS())
            {
                if (wInOrEx == IncludeOrExcept.except && !sunzi.name.Contains(str))
                {
                    GameObject.Destroy(sunzi.gameObject);
                }
                else if (wInOrEx == IncludeOrExcept.include && sunzi.name.Contains(str))
                {
                    GameObject.Destroy(sunzi.gameObject);
                }
            }
        }
    }