Example #1
0
        public void TestInstantiateAndDestroy()
        {
            GameLevel gameLevel = GameState.Instance.gameLevel;

            GameObjectStub gameObject = new GameObjectStub();

            GameObject.Instantiate(gameObject);

            gameLevel.Update(0);
            Assert.AreEqual(1, GameState.Instance.gameLevel.Find <GameObjectStub>().Count);

            gameObject.Destroy();
            gameLevel.Update(0);
            Assert.AreEqual(0, GameState.Instance.gameLevel.Find <GameObjectStub>().Count);
        }
Example #2
0
        public void TestGameObjectInstantiateAndDestroyWithParent()
        {
            GameLevel gameLevel = GameState.Instance.gameLevel;

            GameObjectStub parent = new GameObjectStub();
            GameObjectStub child  = new GameObjectStub();

            GameObject.Instantiate(parent);
            GameObject.Instantiate(child, parent);

            gameLevel.Update(0);
            Assert.AreEqual(2, GameState.Instance.gameLevel.Find <GameObjectStub>().Count);

            parent.Destroy();
            gameLevel.Update(0);
            Assert.AreEqual(0, GameState.Instance.gameLevel.Find <GameObjectStub>().Count);
        }