当前位置: 首页>>代码示例>>C#>>正文


C# EntityBase.Add方法代码示例

本文整理汇总了C#中EntityBase.Add方法的典型用法代码示例。如果您正苦于以下问题:C# EntityBase.Add方法的具体用法?C# EntityBase.Add怎么用?C# EntityBase.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EntityBase的用法示例。


在下文中一共展示了EntityBase.Add方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CleanUpEmptiesNodeList

 public void CleanUpEmptiesNodeList()
 {
     var entity = new EntityBase();
     entity.Add(new Vector2());
     _family.NewEntity(entity);
     var nodes = _family.NodeList;
     _family.CleanUp();
     Assert.IsNull(nodes.Head);
 }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:9,代码来源:ComponentMatchingFamilyTests.cs

示例2: TestComponentAddedChecksWithAllFamilies

 public void TestComponentAddedChecksWithAllFamilies()
 {
     _game.GetNodeList<MockNode>();
     _game.GetNodeList<MockNode2>();
     var entity = new EntityBase();
     _game.AddEntity(entity);
     entity.Add(new Vector2());
     var results = new List<int>
     {
         MockFamily.Instances[0].ComponentAddedCalls,
         MockFamily.Instances[1].ComponentAddedCalls
     };
     Assert.AreEqual(new List<int> { 1, 1 }, results);
 }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:14,代码来源:GameTests.cs

示例3: CleanUpSetsNextNodeToNull

        public void CleanUpSetsNextNodeToNull()
        {
            var entities = new List<EntityBase>();
            for (var i = 0; i < 5; ++i)
            {
                var entity = new EntityBase();
                entity.Add(new Vector2());
                entities.Add(entity);
                _family.NewEntity(entity);
            }

            var nodes = _family.NodeList;
            var node = nodes.Head.Next;
            _family.CleanUp();
            Assert.IsNull(node.Next);
        }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:16,代码来源:ComponentMatchingFamilyTests.cs

示例4: NodeListContainsAllMatchingEntities

        public void NodeListContainsAllMatchingEntities()
        {
            var entities = new List<EntityBase>();
            for (var i = 0; i < 5; ++i)
            {
                var entity = new EntityBase();
                entity.Add(new Vector2());
                entities.Add(entity);
                _family.NewEntity(entity);
                _family.NewEntity(new EntityBase());
            }

            var nodes = _family.NodeList;
            for (var node = nodes.Head; node != null; node = node.Next)
            {
                entities.RemoveAt(entities.IndexOf(node.Entity));
            }
            Assert.AreEqual(0, entities.Count);
        }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:19,代码来源:ComponentMatchingFamilyTests.cs

示例5: NodeListContainsOnlyMatchingEntities

        public void NodeListContainsOnlyMatchingEntities()
        {
            var entities = new List<EntityBase>();
            for (var i = 0; i < 5; ++i)
            {
                var entity = new EntityBase();
                entity.Add(new Vector2());
                entities.Add(entity);
                _family.NewEntity(entity);
                _family.NewEntity(new EntityBase());
            }

            var nodes = _family.NodeList;
            var results = new List<bool>();
            for (var node = nodes.Head; node != null; node = node.Next)
            {
                results.Add(entities.Contains(node.Entity));
            }

            Assert.AreEqual(new List<bool> { true, true, true, true, true }, results);
        }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:21,代码来源:ComponentMatchingFamilyTests.cs

示例6: TestNonMatchingEntityIsNotAddedWhenComponentAdded

 public void TestNonMatchingEntityIsNotAddedWhenComponentAdded()
 {
     var entity = new EntityBase();
     entity.Add(new Matrix4x4());
     _family.ComponentAddedToEntity(entity, typeof(Matrix4x4));
     var nodes = _family.NodeList;
     Assert.IsNull(nodes.Head);
 }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:8,代码来源:ComponentMatchingFamilyTests.cs

示例7: TestNodeContainsEntityProperties

 public void TestNodeContainsEntityProperties()
 {
     var entity = new EntityBase();
     var point = new Vector2(1, 2);
     entity.Add(point);
     _family.NewEntity(entity);
     var nodes = _family.NodeList;
     Assert.AreEqual(point, ((MockNode)nodes.Head).Point);
 }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:9,代码来源:ComponentMatchingFamilyTests.cs

示例8: TestMatchingEntityIsAddedWhenComponentAdded

 public void TestMatchingEntityIsAddedWhenComponentAdded()
 {
     var nodes = _family.NodeList;
     var entity = new EntityBase();
     entity.Add(new Vector2());
     _family.ComponentAddedToEntity(entity, typeof(Vector2));
     Assert.AreSame(entity, nodes.Head.Entity);
 }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:8,代码来源:ComponentMatchingFamilyTests.cs

示例9: TestMatchingEntityIsAddedWhenAccessNodeListSecond

 public void TestMatchingEntityIsAddedWhenAccessNodeListSecond()
 {
     var entity = new EntityBase();
     entity.Add(new Vector2());
     _family.NewEntity(entity);
     var nodes = _family.NodeList;
     Assert.AreSame(entity, nodes.Head.Entity);
 }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:8,代码来源:ComponentMatchingFamilyTests.cs

示例10: TestEntityIsRemovedWhenComponentRemoved

 public void TestEntityIsRemovedWhenComponentRemoved()
 {
     var entity = new EntityBase();
     entity.Add(new Vector2());
     _family.NewEntity(entity);
     entity.Remove(typeof(Vector2));
     _family.ComponentRemovedFromEntity(entity, typeof(Vector2));
     var nodes = _family.NodeList;
     Assert.IsNull(nodes.Head);
 }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:10,代码来源:ComponentMatchingFamilyTests.cs

示例11: TestEntityIsRemovedWhenAccessNodeListSecond

 public void TestEntityIsRemovedWhenAccessNodeListSecond()
 {
     var entity = new EntityBase();
     entity.Add(new Vector2());
     _family.NewEntity(entity);
     _family.RemoveEntity(entity);
     var nodes = _family.NodeList;
     Assert.IsNull(nodes.Head);
 }
开发者ID:kinlam,项目名称:RUN-SHOOT,代码行数:9,代码来源:ComponentMatchingFamilyTests.cs


注:本文中的EntityBase.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。