/// <summary> /// Engines root contextualize your engines and entities. You don't need to limit yourself to one EngineRoot /// as multiple engines root could promote separation of scopes. The EntitySubmissionScheduler checks /// periodically if new entity must be submitted to the database and the engines. It's an external /// dependencies to be independent by the running platform as the user can define it. /// The EntitySubmissionScheduler cannot hold an EnginesRoot reference, that's why /// it must receive a weak reference of the EnginesRoot callback. /// </summary> public EnginesRoot(IEntitiesSubmissionScheduler entitiesComponentScheduler) { _entitiesOperations = new ThreadSafeDictionary <ulong, EntitySubmitOperation>(); serializationDescriptorMap = new SerializationDescriptorMap(); _reactiveEnginesAddRemove = new FasterDictionary <RefWrapper <Type>, FasterList <IEngine> >(); _reactiveEnginesSwap = new FasterDictionary <RefWrapper <Type>, FasterList <IEngine> >(); _enginesSet = new FasterList <IEngine>(); _enginesTypeSet = new HashSet <Type>(); _disposableEngines = new FasterList <IDisposable>(); _transientEntitiesOperations = new FasterList <EntitySubmitOperation>(); _groupEntityComponentsDB = new FasterDictionary <uint, FasterDictionary <RefWrapper <Type>, ITypeSafeDictionary> >(); _groupsPerEntity = new FasterDictionary <RefWrapper <Type>, FasterDictionary <uint, ITypeSafeDictionary> >(); _groupedEntityToAdd = new DoubleBufferedEntitiesToAdd(); _entityLocatorMap = new FasterList <EntityLocatorMapElement>(); _egidToLocatorMap = new FasterDictionary <uint, FasterDictionary <uint, EntityLocator> >(); _entityStreams = EntitiesStreams.Create(); _groupFilters = new FasterDictionary <RefWrapper <Type>, FasterDictionary <ExclusiveGroupStruct, GroupFilters> >(); _entitiesDB = new EntitiesDB(this); scheduler = entitiesComponentScheduler; scheduler.onTick = new EntitiesSubmitter(this); #if UNITY_BURST AllocateNativeOperations(); #endif }
public SECSContext() { Runner = new GameRunner(); Root = new EnginesRoot(Runner.SubmissionScheduler); Engine = new DummyEngine(); Root.AddEngine(Engine); EntitiesDB = Engine.entitiesDB; EntityFactory = Root.GenerateEntityFactory(); EntityFunctions = Root.GenerateEntityFunctions(); ConsumerFactory = Root.GenerateConsumerFactory(); Scheduler = Runner.SubmissionScheduler; GameObjectFactory = new GameObjectFactory(); Time = Runner.Time; }
public GameRunner() { _scheduler = new UnityEntitiesSubmissionScheduler(); _time = new Time(); }
public EnginesRoot (IEntitiesSubmissionScheduler entitiesComponentScheduler, bool isDeserializationOnly) : this(entitiesComponentScheduler) { _isDeserializationOnly = isDeserializationOnly; }