public void Register() { if (mIsRegistered) { return; } mSystemsIds = new List <SystemId>(); SystemId systemId = (SystemId)0x0; for (int i = 0; i < mSystems.Count; ++i) { switch (mSystems[i]) { case IInitSystem initSystem: systemId = mSystemManager.RegisterSystem(initSystem); break; case IUpdateSystem updateSystem: systemId = mSystemManager.RegisterSystem(updateSystem); break; case IReactiveSystem reactiveSystem: systemId = mSystemManager.RegisterSystem(reactiveSystem); break; } mSystemsIds.Add(systemId); } mIsRegistered = true; }
public void TestRegisterInitSystem_PassNullArgument_ThrowsException() { Assert.Throws <ArgumentNullException>(() => { mSystemManager.RegisterSystem((IInitSystem)null); }); }
public void TestDisposableEntitiesCollectorSystem_ThereAreNoDisposableEntitiesAtInput_DoNothing() { mSystemManager.RegisterSystem(new PureUpdateSystemAdapter(mWorldContext, BuiltinSystems.DisposableEntitiesCollectorSystem)); int expectedNumOfDisposableEntities = 5; for (int i = 0; i < expectedNumOfDisposableEntities; ++i) { mWorldContext.CreateDisposableEntity(); } Assert.AreEqual(expectedNumOfDisposableEntities, mWorldContext.GetEntitiesWithAll(typeof(TDisposableComponent)).Count); mSystemManager.Init(); mSystemManager.Update(0.0f); Assert.AreEqual(0, mWorldContext.GetEntitiesWithAll(typeof(TDisposableComponent)).Count); }
/// <summary> /// The method register the system within the given system manager based on the type /// </summary> /// <param name="systemManager">A reference to ISystemManager implementation</param> public override void RegisterItself(ISystemManager systemManager) { if (systemManager == null) { throw new System.ArgumentNullException("systemManager"); } systemManager.RegisterSystem(this); }
public void Init() { mWorldContext = new WorldContextFactory().CreateNewWorldInstance(); mSystemManager = new SystemManager(mWorldContext); mRegisterViewsSystem = new RegisterViewSystem(mWorldContext); mSystemManager.RegisterSystem(mRegisterViewsSystem); mSystemManager.Init(); }
protected void Awake() { mWorldContext = new WorldContextFactory().CreateNewWorldInstance(); mSystemManager = new SystemManager(mWorldContext); WorldContextsManagerUtils.CreateWorldContextManager(mWorldContext, "WorldsContextsManager_System"); SystemManagerObserverUtils.CreateSystemManagerObserver(mSystemManager, "SystemManagerObserver_System"); mSystemManager.RegisterSystem(new RegisterViewSystem(mWorldContext)); mSystemManager.Init(); }
public void RegisterItself(ISystemManager systemManager) { systemManager?.RegisterSystem(this); }