Entitas.Systems.ActivateReactiveSystems C# (CSharp) Method

ActivateReactiveSystems() public method

public ActivateReactiveSystems ( ) : void
return void
        public virtual void ActivateReactiveSystems()
        {
            for (int i = 0; i < _executeSystems.Count; i++) {
                var system = _executeSystems[i];
                var reactiveSystem = system as ReactiveSystem;
                if(reactiveSystem != null) {
                    reactiveSystem.Activate();
                }

                var nestedSystems = system as Systems;
                if(nestedSystems != null) {
                    nestedSystems.ActivateReactiveSystems();
                }
            }
        }

Usage Example

Example #1
0
        private void SetupSystems()
        {
            //a feature is a group of systems
            _pausableUpdateSystems = new Feature();

            _pausableUpdateSystems.Add(_pool.CreateSystem <StartNextRoundSystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <VelocitySystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <AcceptInputSystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <AISystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <GoalSystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <DestroySystem> ());

            //	'Collision' as NOT physics based - as an example
            _pausableUpdateSystems.Add(_pool.CreateSystem <BoundsBounceSystem> ());
            _pausableUpdateSystems.Add(_pool.CreateSystem <BoundsConstrainSystem> ());
            _pausableUpdateSystems.Initialize();
            _pausableUpdateSystems.ActivateReactiveSystems();


            _pausableFixedUpdateSystems = new Feature();
            //  'Collision as Physics based - as an example.
            _pausableFixedUpdateSystems.Add(_pool.CreateSystem <CollisionSystem> ());
            _pausableFixedUpdateSystems.Initialize();
            _pausableFixedUpdateSystems.ActivateReactiveSystems();


            //for demo only, an example of an unpausable system
            _unpausableUpdateSystems = new Feature();
            _unpausableUpdateSystems.Add(_pool.CreateSystem <TimeSystem> ());
            _unpausableUpdateSystems.Initialize();
            _unpausableUpdateSystems.ActivateReactiveSystems();

            // This is custom and optional. I use it to store the systems in case I need them again.
            // This is the only place I put a component directly on a _pool. It is supported.
            // I'm not sure this is useful, but I saw something similar in Entitas presentation slides - srivello
            _pool.SetEntitas
            (
                _pausableUpdateSystems,
                _unpausableUpdateSystems,
                _pausableUpdateSystems
            );
            //Debug.Log("pausableUpdateSystems: " + Pools.pool.entitas.pausableUpdateSystems);
        }
All Usage Examples Of Entitas.Systems::ActivateReactiveSystems