예제 #1
0
파일: AshTests.cs 프로젝트: copperbyte/Ash
        public void testEntityNodeList()
        {
            Entity entity = new Entity();
            Id id = new Id();
            id.Value = 1;
            entity.Add(id);
            Name name = new Name();
            name.Value = "bob";
            entity.Add(name);

            NodeList<TestNode> nodeList = Ash.GetNodeList<TestNode>();
            Assert.AreEqual(nodeList.Count, 0);

            Ash.AddEntity(entity);
            Assert.AreEqual(nodeList.Count, 1);

            Ash.RemoveEntity(entity);
            Assert.AreEqual(nodeList.Count, 0);
        }
예제 #2
0
파일: AshTests.cs 프로젝트: copperbyte/Ash
        public void testEntityCount()
        {
            Entity entity = new Entity();
            Id id = new Id();
            id.Value = 1;
            entity.Add(id);
            Name name = new Name();
            name.Value = "bob";
            entity.Add(name);

            int Count = Ash.EntityCount();
            Assert.AreEqual(Count, 0);

            Ash.AddEntity(entity);
            Count = Ash.EntityCount();
            Assert.AreEqual(Count, 1);

            Ash.RemoveEntity(entity);
            Count = Ash.EntityCount();
            Assert.AreEqual(Count, 0);
        }
예제 #3
0
파일: AshTests.cs 프로젝트: copperbyte/Ash
        public void testFamilyAs()
        {
            Entity entity = new Entity();

            NodeList<TestNode> nodeList = Ash.GetNodeList<TestNode>();
            Assert.AreEqual(nodeList.Count, 0);

            bool IsNode = false;

            IsNode = Ash.Is<TestNode>(entity);
            Assert.AreEqual(IsNode, false);

            Id id = new Id();
            id.Value = 1;
            entity.Add(id);

            IsNode = Ash.Is<TestNode>(entity);
            Assert.AreEqual(IsNode, false);

            Ash.AddEntity(entity);

            IsNode = Ash.Is<TestNode>(entity);
            Assert.AreEqual(IsNode, false);

            TestNode node = null;
            node = Ash.As<TestNode>(entity);
            Assert.AreEqual(node, null);

            Name name = new Name();
            name.Value = "bob";
            entity.Add(name);

            Assert.AreEqual(nodeList.Count, 1);

            IsNode = Ash.Is<TestNode>(entity);
            Assert.AreEqual(IsNode, true);

            node = Ash.As<TestNode>(entity);
            Assert.AreNotEqual(node, null);

            Ash.RemoveEntity(entity);
            Assert.AreEqual(nodeList.Count, 0); // entity should no longer be in nodeList
        }
예제 #4
0
파일: AshTests.cs 프로젝트: copperbyte/Ash
        public void testRemoveComponent()
        {
            Entity entity = new Entity();
            Id id = new Id();
            id.Value = 1;
            entity.Add(id);
            Name name = new Name();
            name.Value = "bob";
            entity.Add(name);

            NodeList<TestNode> nodeList = Ash.GetNodeList<TestNode>();

            Ash.AddEntity(entity);
            //Ash.RemoveEntity(entity);
            Assert.AreEqual(nodeList.Count, 1);

            entity.Remove(typeof(Name));
            Assert.AreEqual(nodeList.Count, 0); // entity should no longer be in nodeList
        }