コード例 #1
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());
        }
コード例 #2
0
        public IEnumerator createTest()
        {
            Transform root   = new GameObject("Root").transform;
            Transform origin = new GameObject("Origin").transform;
            ComponentPool <Transform> list = new ComponentPool <Transform>(root, origin);
            Transform clone = list.create();

            Assert.NotNull(clone);
            yield return(new WaitForEndOfFrame());

            Assert.False(origin == clone);
            list.remove(clone);
            Assert.AreEqual(0, list.count);
            Transform pooled = list.create();

            Assert.AreEqual(clone, pooled);
        }