Exemple #1
0
        public IEnumerator addAndGetTest()
        {
            Transform root   = new GameObject("Root").transform;
            Transform origin = new GameObject("Origin").transform;
            ComponentPool <Transform> list = new ComponentPool <Transform>(root, origin);

            list.add(Object.Instantiate(origin));
            Transform nullObj = Object.Instantiate(origin);

            list.add(nullObj);
            Object.Destroy(nullObj.gameObject);
            yield return(new WaitForEndOfFrame());

            Assert.AreEqual(1, list.count);
            Assert.AreEqual(1, root.transform.childCount);
        }
Exemple #2
0
        public IEnumerator removeTest()
        {
            Transform root   = new GameObject("Root").transform;
            Transform origin = new GameObject("Origin").transform;
            ComponentPool <Transform> list = new ComponentPool <Transform>(root, origin);
            Transform component            = Object.Instantiate(origin);

            list.add(component);
            Assert.True(list.remove(component));
            yield return(new WaitForEndOfFrame());
        }