本文整理汇总了C#中System.Entity.Destroy方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.Destroy方法的具体用法?C# Entity.Destroy怎么用?C# Entity.Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Entity
的用法示例。
在下文中一共展示了Entity.Destroy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveEntity
public virtual void RemoveEntity(Entity entity) {
var removed = _entities.Remove(entity);
if (!removed)
throw new EntityNotInPoolException(entity, "Could not remove entity");
// Inform subscribers the entity is going to be removed
OnEntityRemoving.Invoke(this, new PoolChanged(this, entity));
// Prepare it for removal
entity.Destroy();
// Inform subscribers the entity has been removed
OnEntityRemoved.Invoke(this, new PoolChanged(this, entity));
// Remove the item from memory
entity.Dispose();
}
示例2: ObjectRemovedInvokedWhenAnEntityIsDestroyed
public void ObjectRemovedInvokedWhenAnEntityIsDestroyed()
{
var entity = new Entity(new VariableCollection());
this.collection.Add(entity);
var called = false;
collection.ObjectRemoved += (x) => { called = true; };
entity.Destroy();
MonocleObject.LifeTimeManager.DestroyObjectsFlaggedForDestruction();
Assert.IsTrue(called);
}
示例3: ObjectAddedInvokedWhenAnEntityIsAdded
public void ObjectAddedInvokedWhenAnEntityIsAdded()
{
Entity e = null;
collection.ObjectAdded += (x) => { e = (Entity)x; };
var entity = new Entity(new VariableCollection());
collection.Add(entity);
Assert.AreSame(e, entity);
entity.Destroy();
}
示例4: EntityCanBeAdded
public void EntityCanBeAdded()
{
var entity = new Entity(new VariableCollection());
collection.Add(entity);
Assert.NotNull(collection.Find((x) => true));
entity.Destroy();
}
示例5: ComponentCreatedInvokedWhenAComponentIsCreated
public void ComponentCreatedInvokedWhenAComponentIsCreated()
{
var entity = new Entity(new VariableCollection());
this.collection.Add(entity);
var called = false;
collection.ObjectAdded += (x) => { called = true; };
entity.AddComponent<FakeComp>();
Assert.IsTrue(called);
entity.Destroy();
}
示例6: Kill
public static void Kill(Monster monster, Entity sender, EventArgs args)
{
if (sender is Unit)
(sender as Unit).Kill();
else
sender.Destroy();
}
示例7: Destroy
//-----------------------------------------------------------------------------
// Basic Sender Reactions
//-----------------------------------------------------------------------------
public static void Destroy(Monster monster, Entity sender, EventArgs args)
{
sender.Destroy();
}
示例8: Burn
// Burn the monster for 1 damage.
public static void Burn(Monster monster, Entity sender, EventArgs args)
{
monster.Burn(1);
if (sender is Fire)
sender.Destroy();
}
示例9: DestroyAlsoDestroysAllChildren
public void DestroyAlsoDestroysAllChildren()
{
var entity1 = new Entity(new VariableCollection());
entity.Parent = entity1;
entity1.Destroy();
MonocleObject.LifeTimeManager.DestroyObjectsFlaggedForDestruction();
Assert.IsTrue(entity == null);
}