本文整理汇总了C#中Artemis.EntityWorld.DeleteEntity方法的典型用法代码示例。如果您正苦于以下问题:C# EntityWorld.DeleteEntity方法的具体用法?C# EntityWorld.DeleteEntity怎么用?C# EntityWorld.DeleteEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artemis.EntityWorld
的用法示例。
在下文中一共展示了EntityWorld.DeleteEntity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestUniqueId
public void TestUniqueId()
{
Debug.WriteLine("Initialize EntityWorld: ");
EntityWorld entityWorld = new EntityWorld();
entityWorld.SystemManager.SetSystem(new TestCommunicationSystem(), GameLoopType.Update);
entityWorld.InitializeAll();
Debug.WriteLine("OK");
Entity ent1 = TestEntityFactory.CreateTestHealthEntityWithId(entityWorld, -5);
Debug.WriteLine("ID1 " + ent1.UniqueId);
Debug.Assert(ent1.UniqueId == -5, "Ids dont match");
Entity ent2 = TestEntityFactory.CreateTestHealthEntity(entityWorld);
Debug.WriteLine("ID2 " + ent2.UniqueId);
Debug.Assert(ent2.UniqueId != -5 && ent2.UniqueId > 0, "Ids cant match");
Entity entrec = entityWorld.EntityManager.GetEntityByUniqueId(-5);
Debug.Assert(ent1 == entrec, "Entities must match");
entrec = entityWorld.EntityManager.GetEntity(ent1.Id);
Debug.Assert(ent1 == entrec, "Entities must match");
entityWorld.DeleteEntity(ent1);
entityWorld.Update();
entrec = entityWorld.EntityManager.GetEntityByUniqueId(-5);
Debug.Assert(entrec == null, "Entity must be null");
entrec = entityWorld.EntityManager.GetEntity(ent1.Id);
Debug.Assert(entrec == null, "Entity must be null");
Debug.WriteLine("OK");
}
示例2: TestUniqId
public void TestUniqId()
{
global::System.Diagnostics.Debug.WriteLine("Initialize EntityWorld: ");
EntityWorld entityWorld = new EntityWorld();
entityWorld.SystemManager.SetSystem(new TestCommunicationSystem(), GameLoopType.Update);
#if !FULLDOTNET && !METRO
entityWorld.InitializeAll();
#else
entityWorld.InitializeAll(false);
#endif
global::System.Diagnostics.Debug.WriteLine("OK");
var ent1 = TestEntityFactory.CreateTestHealthEntityWithID(entityWorld, -5);
global::System.Diagnostics.Debug.WriteLine("ID1 " + ent1.UniqueId );
Debug.Assert(ent1.UniqueId == -5, "Ids dont match");
var ent2 = TestEntityFactory.CreateTestHealthEntity(entityWorld);
global::System.Diagnostics.Debug.WriteLine("ID2 " + ent2.UniqueId);
Debug.Assert(ent2.UniqueId != -5 && ent2.UniqueId > 0, "Ids cant match");
var entrec = entityWorld.EntityManager.GetEntityByUniqueID(-5);
Debug.Assert(ent1 == entrec, "Entities must match");
entrec = entityWorld.EntityManager.GetEntity(ent1.Id);
Debug.Assert(ent1 == entrec, "Entities must match");
entityWorld.DeleteEntity(ent1);
entityWorld.Update();
entrec = entityWorld.EntityManager.GetEntityByUniqueID(-5);
Debug.Assert(entrec==null, "Entity must be null");
entrec = entityWorld.EntityManager.GetEntity(ent1.Id);
Debug.Assert(entrec == null, "Entity must be null");
global::System.Diagnostics.Debug.WriteLine("OK");
}