本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}