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


C# Entitas.Pool类代码示例

本文整理汇总了C#中Entitas.Pool的典型用法代码示例。如果您正苦于以下问题:C# Pool类的具体用法?C# Pool怎么用?C# Pool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Pool类属于Entitas命名空间,在下文中一共展示了Pool类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: animatingComponent

 static void animatingComponent(Pool pool)
 {
     var e = pool.animatingEntity;
     var isAnimating = pool.isAnimating;
     pool.isAnimating = true;
     pool.isAnimating = false;
 }
开发者ID:npruehs,项目名称:Entitas-CSharp,代码行数:7,代码来源:ReadmeSnippets.cs

示例2: ReactiveSystem

        ReactiveSystem(Pool pool, IReactiveExecuteSystem subSystem, TriggerOnEvent[] triggers)
        {
            _subsystem = subSystem;
            var ensureComponents = subSystem as IEnsureComponents;
            if (ensureComponents != null) {
                _ensureComponents = ensureComponents.ensureComponents;
            }
            var excludeComponents = subSystem as IExcludeComponents;
            if (excludeComponents != null) {
                _excludeComponents = excludeComponents.excludeComponents;
            }

            _clearAfterExecute = (subSystem as IClearReactiveSystem) != null;

            var triggersLength = triggers.Length;
            var groups = new Group[triggersLength];
            var eventTypes = new GroupEventType[triggersLength];
            for (int i = 0; i < triggersLength; i++) {
                var trigger = triggers[i];
                groups[i] = pool.GetGroup(trigger.trigger);
                eventTypes[i] = trigger.eventType;
            }
            _observer = new GroupObserver(groups, eventTypes);
            _buffer = new List<Entity>();
        }
开发者ID:robinryf,项目名称:Entitas-CSharp,代码行数:25,代码来源:ReactiveSystem.cs

示例3: SetPool

 public void SetPool(Pool pool)
 {
     _pool = pool;
     _asteroids = pool.GetGroup(Matcher.Asteroid);
     _levels = pool.GetGroup(Matcher.Level);
     _players = pool.GetGroup(Matcher.Player);
 }
开发者ID:jyunfan2015,项目名称:Entitasteroids,代码行数:7,代码来源:LevelEndingSystem.cs

示例4: CreateSystems

        private Systems CreateSystems(Pool pool)
        {
#if (UNITY_EDITOR)
            return new DebugSystems()
#else
        return new Systems()
#endif
                .Add(pool.CreateSystem<TickingSystem>())
                .Add(pool.CreateSystem<PositionUpdatingSystem>())
                .Add(pool.CreateSystem<RenderForceSystem>())
                .Add(pool.CreateSystem<BulletCollisionSystem>())
                .Add(pool.CreateSystem<AddViewSystem>())
                .Add(pool.CreateSystem<LevelStartingSystem>())
                .Add(pool.CreateSystem<SpaceshipControlsSystem>())
                .Add(pool.CreateSystem<AddRigidbodySystem>())
                .Add(pool.CreateSystem<AgingSystem>())
                .Add(pool.CreateSystem<MaxAgeSystem>())
                .Add(pool.CreateSystem<AsteroidSplittingSystem>())
                .Add(pool.CreateSystem<RenderRotationSystem>())
                .Add(pool.CreateSystem<GunFiringSystem>())
                .Add(pool.CreateSystem<GunCooldownSystem>())
                .Add(pool.CreateSystem<LevelEndingSystem>())
                .Add(pool.CreateSystem<SpaceshipRespawningSystem>())
                .Add(pool.CreateSystem<SpaceshipCollisionSystem>())
                .Add(pool.CreateSystem<InputDestructionSystem>())
                .Add(pool.CreateSystem<BoundsWrappingSystem>())
                .Add(pool.CreateSystem<RenderPositionSystem>())
                .Add(pool.CreateSystem<RemoveViewSystem>())
                .Add(pool.CreateSystem<DestroyingSystem>());
        }
开发者ID:jyunfan2015,项目名称:Entitasteroids,代码行数:30,代码来源:GameController.cs

示例5: Init

 public void Init(Pool pool, Entity entity)
 {
     _pool = pool;
     _entity = entity;
     _entity.OnEntityReleased += onEntityReleased;
     Update();
 }
开发者ID:robinryf,项目名称:Entitas-CSharp,代码行数:7,代码来源:EntityBehaviour.cs

示例6: moveSystem

 static void moveSystem(Pool pool) {
     var entities = pool.GetEntities(Matcher.AllOf(Matcher.Move, Matcher.Position));
     foreach (var entity in entities) {
         var move = entity.move;
         var pos = entity.position;
         entity.ReplacePosition(pos.x, pos.y + move.speed);
     }
 }
开发者ID:mihail-georgiev,项目名称:Entitas-CSharp,代码行数:8,代码来源:ReadmeSnippets.cs

示例7: SetPool

 public void SetPool(Pool pool)
 {
     _pool = pool;
     _pool.GetGroup(Matcher.SpaceshipDeathroes).OnEntityRemoved += OnDeaththroesRemoved;
     _waiting = _pool.GetGroup(Matcher.AllOf(Matcher.WaitingForSpace, Matcher.Spaceship));
     _asteroids = pool.GetGroup(Matcher.AllOf(Matcher.Asteroid, Matcher.CollisionRadius));
     _games = _pool.GetGroup(Matcher.AllOf(Matcher.Game, Matcher.Bounds));
     _lives = _pool.GetGroup(Matcher.Lives);
 }
开发者ID:jyunfan2015,项目名称:Entitasteroids,代码行数:9,代码来源:SpaceshipRespawningSystem.cs

示例8: Init

        public void Init(Pool pool, Entity entity)
        {
            _pool = pool;
            _entity = entity;
            _unfoldedComponents = new bool[_pool.totalComponents];
            _entity.OnComponentRemoved += onComponentRemoved;

            UnfoldAllComponents();
        }
开发者ID:namlunoy,项目名称:Entitas-CSharp,代码行数:9,代码来源:EntityBehaviour.cs

示例9: groupExample

        static void groupExample(Pool pool) {
            pool.GetGroup(Matcher.Position).GetEntities();

            // ----------------------------

            pool.GetGroup(Matcher.Position).OnEntityAdded += (group, entity) => {
                // Do something
            };
        }
开发者ID:mihail-georgiev,项目名称:Entitas-CSharp,代码行数:9,代码来源:ReadmeSnippets.cs

示例10: ReactiveSystem

 ReactiveSystem(Pool pool, IReactiveExecuteSystem subSystem, IMatcher[] triggers, GroupEventType[] eventTypes)
 {
     _subsystem = subSystem;
     var groups = new Group[triggers.Length];
     for (int i = 0, triggersLength = triggers.Length; i < triggersLength; i++) {
         groups[i] = pool.GetGroup(triggers[i]);
     }
     _observer = new GroupObserver(groups, eventTypes);
     _buffer = new List<Entity>();
 }
开发者ID:Geroppo,项目名称:Entitas-CSharp,代码行数:10,代码来源:ReactiveSystem.cs

示例11: Init

        public void Init(Pool pool, Entity entity, Type[] componentTypes) {
            _pool = pool;
            _entity = entity;
            _componentTypes = componentTypes;
            componentToAdd = -1;
            _unfoldedComponents = new bool[_pool.totalComponents];
            _entity.OnEntityReleased += onEntityReleased;
            Update();

            UnfoldAllComponents();
        }
开发者ID:thebatoust,项目名称:EntitasTurnBasedGame,代码行数:11,代码来源:EntityBehaviour.cs

示例12: Init

        public void Init(Pool pool, Entity entity, int debugIndex)
        {
            _pool = pool;
            _entity = entity;
            _debugIndex = debugIndex;
            _unfoldedComponents = new bool[_pool.totalComponents];
            _entity.OnComponentAdded += onEntityChanged;
            _entity.OnComponentRemoved += onEntityChanged;
            updateName();

            UnfoldAllComponents();
        }
开发者ID:fversnel,项目名称:Entitas-CSharp,代码行数:12,代码来源:EntityDebugBehaviour.cs

示例13: groupObserverExample

        static void groupObserverExample(Pool pool)
        {
            var group = pool.GetGroup(Matcher.Position);
            var observer = group.CreateObserver(GroupEventType.OnEntityAdded);

            // ----------------------------
            foreach (var e in observer.collectedEntities) {
                // do something
            }
            observer.ClearCollectedEntities();

            // ----------------------------
            observer.Deactivate();
        }
开发者ID:npruehs,项目名称:Entitas-CSharp,代码行数:14,代码来源:ReadmeSnippets.cs

示例14: Start

        public void Start()
        {
            pool = Pools.pool;

            pool.GetGroup(EntitysToBeViewed).OnEntityAdded += (group, entity, index, component) => OnEntityAdded(entity);

            pool.GetGroup(EntitysToBeViewed).OnEntityRemoved +=
                (group, entity, index, component) => OnEntityRemoved(entity);

            pool.GetGroup(Matcher.GameState).OnEntityAdded +=
                (group, entity, index, component) => OnGameStateUpdated(entity.gameState.GameState);

            tableContents = new Dictionary<int, GameObject>();
        }
开发者ID:callumlawson,项目名称:FinalFlight,代码行数:14,代码来源:TableViewVisualizer.cs

示例15: ReactiveSystem

 ReactiveSystem(Pool pool, IReactiveExecuteSystem subSystem, IMatcher[] triggers, GroupEventType[] eventTypes)
 {
     _subsystem = subSystem;
     var ensureComponents = subSystem as IEnsureComponents;
     if (ensureComponents != null) {
         _ensureComponents = ensureComponents.ensureComponents;
     }
     var excludeComponents = subSystem as IExcludeComponents;
     if (excludeComponents != null) {
         _excludeComponents = excludeComponents.excludeComponents;
     }
     var groups = new Group[triggers.Length];
     for (int i = 0, triggersLength = triggers.Length; i < triggersLength; i++) {
         groups[i] = pool.GetGroup(triggers[i]);
     }
     _observer = new GroupObserver(groups, eventTypes);
     _buffer = new List<Entity>();
 }
开发者ID:KevinQiangK,项目名称:Entitas-CSharp,代码行数:18,代码来源:ReactiveSystem.cs


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