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


C# Entity.destroy方法代码示例

本文整理汇总了C#中Entity.destroy方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.destroy方法的具体用法?C# Entity.destroy怎么用?C# Entity.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entity的用法示例。


在下文中一共展示了Entity.destroy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DestroyEntity

        public virtual void DestroyEntity(Entity entity) {
            var removed = _entities.Remove(entity);
            if (!removed) {
                throw new PoolDoesNotContainEntityException(entity,
                    "Could not destroy entity!");
            }
            _entitiesCache = null;

            if (OnEntityWillBeDestroyed != null) {
                OnEntityWillBeDestroyed(this, entity);
            }

            entity.destroy();

            if (OnEntityDestroyed != null) {
                OnEntityDestroyed(this, entity);
            }

            if (entity._refCount == 1) {
                entity.OnEntityReleased -= _cachedOnEntityReleased;
                _reusableEntities.Push(entity);
            } else {
                _retainedEntities.Add(entity);
            }
            entity.Release();
        }
开发者ID:jyunfan2015,项目名称:Entitasteroids,代码行数:26,代码来源:Pool.cs

示例2: DestroyEntity

 //Its possible that we create a bullet and say 'destroy yourself in 4 seconds' and then the bullet collides and we say destroy yourself now,
 //then the 4 seconds expires and it tries to delete itself again.
 //So this 'if' solves that - srivello
 private void DestroyEntity(Entity entity)
 {
     if (_pool.HasEntity(entity))
     {
         _pool.DestroyEntity(entity);
     }
     else
     {
         entity.destroy();
     }
 }
开发者ID:RivelloMultimediaConsulting,项目名称:EntitasCoverShooter,代码行数:14,代码来源:DestroySystem.cs

示例3: DestroyEntity

        public virtual void DestroyEntity(Entity entity) {
            var removed = _entities.Remove(entity);
            if (!removed) {
                throw new PoolDoesNotContainEntityException("'" + this + "' cannot destroy " + entity + "!",
                    "Did you call pool.DestroyEntity() on a wrong pool?");
            }
            _entitiesCache = null;

            if (OnEntityWillBeDestroyed != null) {
                OnEntityWillBeDestroyed(this, entity);
            }

            entity.destroy();

            if (OnEntityDestroyed != null) {
                OnEntityDestroyed(this, entity);
            }

            if (entity.retainCount == 1) {
                entity.OnEntityReleased -= _cachedOnEntityReleased;
                _reusableEntities.Push(entity);
            } else {
                _retainedEntities.Add(entity);
            }
            entity.Release(this);
        }
开发者ID:thebatoust,项目名称:EntitasTurnBasedGame,代码行数:26,代码来源:Pool.cs

示例4: DestroyEntity

        public virtual void DestroyEntity(Entity entity)
        {
            var removed = _entities.Remove(entity);
            if(!removed) {
                throw new ContextDoesNotContainEntityException(
                    "'" + this + "' cannot destroy " + entity + "!",
                    "Did you call context.DestroyEntity() on a wrong context?"
                );
            }
            _entitiesCache = null;

            if(OnEntityWillBeDestroyed != null) {
                OnEntityWillBeDestroyed(this, entity);
            }

            entity.destroy();

            if(OnEntityDestroyed != null) {
                OnEntityDestroyed(this, entity);
            }

            if(entity.retainCount == 1) {
                // Can be released immediately without
                // adding to _retainedEntities
                entity.OnEntityReleased -= _cachedEntityReleased;
                _reusableEntities.Push(entity);
                entity.Release(this);
                entity.removeAllOnEntityReleasedHandlers();
            } else {
                _retainedEntities.Add(entity);
                entity.Release(this);
            }
        }
开发者ID:sschmid,项目名称:Entitas-CSharp,代码行数:33,代码来源:Context.cs


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