public void EnableWithPositionAndRotation() { var source = new GameObject().AddComponent <GameObjectPoolBehaviour>(); var pool = new GameObjectPoolCollectionRing <GameObjectPoolBehaviour>(); source.PoolDisable(); pool.Add(source); GameObjectPoolBehaviour behaviour = pool.Enable(Vector3.one, Quaternion.Euler(Vector3.one)); behaviour.PoolEnable(); Assert.NotNull(behaviour); Assert.True(behaviour.IsPoolEnabled()); Assert.AreEqual(Vector3.one, behaviour.transform.position); Assert.True(QuaternionEqualityComparer.Instance.Equals(Quaternion.Euler(Vector3.one), behaviour.transform.rotation)); }
public void EnableWithParent() { var source = new GameObject().AddComponent <GameObjectPoolBehaviour>(); var pool = new GameObjectPoolCollectionRing <GameObjectPoolBehaviour>(); source.PoolDisable(); pool.Add(source); Transform parent = new GameObject().transform; GameObjectPoolBehaviour behaviour = pool.Enable(parent); behaviour.PoolEnable(); Assert.NotNull(behaviour); Assert.True(behaviour.IsPoolEnabled()); Assert.AreEqual(parent, behaviour.transform.parent); }
public void Disable() { var source = new GameObject().AddComponent <GameObjectPoolBehaviour>(); var pool = new GameObjectPoolCollectionRing <GameObjectPoolBehaviour>(); source.PoolDisable(); pool.Add(source); GameObjectPoolBehaviour behaviour = pool.Enable(); behaviour.PoolEnable(); Assert.NotNull(behaviour); Assert.True(behaviour.IsPoolEnabled()); bool result0 = pool.Disable(behaviour); behaviour.PoolDisable(); Assert.True(result0); Assert.False(behaviour.IsPoolEnabled()); }