/// This is the recommended way to create systems. /// It will inject the pools if ISetPools is implemented. public static ISystem CreateSystem(this Pools pools, ISystem system) { SetPools(system, pools); return(system); }
/// This is the recommended way to create systems. /// It will inject the pool if ISetPool is implemented. /// It will inject the pools if ISetPools is implemented. /// It will automatically create a ReactiveSystem if it is a IReactiveSystem, IMultiReactiveSystem or IEntityCollectorSystem. public static ISystem CreateSystem(this Pool pool, IReactiveExecuteSystem system, Pools pools) { SetPool(system, pool); SetPools(system, pools); var reactiveSystem = system as IReactiveSystem; if (reactiveSystem != null) { return(new ReactiveSystem(pool, reactiveSystem)); } var multiReactiveSystem = system as IMultiReactiveSystem; if (multiReactiveSystem != null) { return(new ReactiveSystem(pool, multiReactiveSystem)); } var entityCollectorSystem = system as IEntityCollectorSystem; if (entityCollectorSystem != null) { return(new ReactiveSystem(entityCollectorSystem)); } throw new EntitasException( "Could not create ReactiveSystem for " + system + "!", "The system has to implement IReactiveSystem, IMultiReactiveSystem or IEntityCollectorSystem." ); }