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


C# Entity.Destroy方法代码示例

本文整理汇总了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();
        }
开发者ID:LambdaSix,项目名称:Capsicum,代码行数:18,代码来源:Pool.cs

示例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);
        }
开发者ID:TheFlyingFiddle,项目名称:Project-Monocle,代码行数:11,代码来源:EntityCollectionTest.cs

示例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();
        }
开发者ID:TheFlyingFiddle,项目名称:Project-Monocle,代码行数:11,代码来源:EntityCollectionTest.cs

示例4: EntityCanBeAdded

        public void EntityCanBeAdded()
        {
            var entity = new Entity(new VariableCollection());
            collection.Add(entity);

            Assert.NotNull(collection.Find((x) => true));
            entity.Destroy();
        }
开发者ID:TheFlyingFiddle,项目名称:Project-Monocle,代码行数:8,代码来源:EntityCollectionTest.cs

示例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();
        }
开发者ID:TheFlyingFiddle,项目名称:Project-Monocle,代码行数:11,代码来源:EntityCollectionTest.cs

示例6: Kill

 public static void Kill(Monster monster, Entity sender, EventArgs args)
 {
     if (sender is Unit)
         (sender as Unit).Kill();
     else
         sender.Destroy();
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:7,代码来源:MonsterReactions.cs

示例7: Destroy

 //-----------------------------------------------------------------------------
 // Basic Sender Reactions
 //-----------------------------------------------------------------------------
 public static void Destroy(Monster monster, Entity sender, EventArgs args)
 {
     sender.Destroy();
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:7,代码来源:MonsterReactions.cs

示例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();
 }
开发者ID:trigger-death,项目名称:ZeldaOracle,代码行数:7,代码来源:MonsterReactions.cs

示例9: DestroyAlsoDestroysAllChildren

        public void DestroyAlsoDestroysAllChildren()
        {
            var entity1 = new Entity(new VariableCollection());
            entity.Parent = entity1;

            entity1.Destroy();
            MonocleObject.LifeTimeManager.DestroyObjectsFlaggedForDestruction();

            Assert.IsTrue(entity == null);
        }
开发者ID:TheFlyingFiddle,项目名称:Project-Monocle,代码行数:10,代码来源:EntityTest.cs


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