Ejemplo n.º 1
0
        public static void DestroyAllChildren(this Transform transform, bool immediate = false)
        {
            List <GameObject> list = Pool.GetList <GameObject>();

            foreach (Transform transforms in transform)
            {
                if (transforms.CompareTag("persist"))
                {
                    continue;
                }
                list.Add(transforms.gameObject);
            }
            if (!immediate)
            {
                foreach (GameObject gameObject in list)
                {
                    GameManager.Destroy(gameObject, 0f);
                }
            }
            else
            {
                foreach (GameObject gameObject1 in list)
                {
                    GameManager.DestroyImmediate(gameObject1, false);
                }
            }
            Pool.FreeList <GameObject>(ref list);
        }
Ejemplo n.º 2
0
        public static T GetComponentInChildrenIncludeDisabled <T>(this Transform transform)
            where T : Component
        {
            T        t;
            List <T> list = Pool.GetList <T>();

            transform.GetComponentsInChildren <T>(true, list);
            t = (list.Count > 0 ? list[0] : default(T));
            Pool.FreeList <T>(ref list);
            return(t);
        }
Ejemplo n.º 3
0
        public static void RetireAllChildren(this Transform transform, GameManager gameManager)
        {
            List <GameObject> list = Pool.GetList <GameObject>();

            foreach (Transform transforms in transform)
            {
                if (transforms.CompareTag("persist"))
                {
                    continue;
                }
                list.Add(transforms.gameObject);
            }
            foreach (GameObject gameObject in list)
            {
                gameManager.Retire(gameObject);
            }
            Pool.FreeList <GameObject>(ref list);
        }