本文整理匯總了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);
}