public void Tick(float dt) { ElapsedTime += dt; DefaultWorld.SetTime(new TimeData(ElapsedTime, dt)); ServerWorld?.SetTime(new TimeData(ElapsedTime, dt)); ClientWorld?.SetTime(new TimeData(ElapsedTime, dt)); ServerWorld?.GetExistingSystem <ServerInitializationSystemGroup>().Update(); ClientWorld.GetExistingSystem <ClientInitializationSystemGroup>().Update(); DefaultWorld.GetExistingSystem <ChainServerSimulationSystem>().Update(); DefaultWorld.GetExistingSystem <ChainClientSimulationSystem>().Update(); ClientWorld.GetExistingSystem <ClientPresentationSystemGroup>().Update(); }
public bool Connect(float dt, int maxSteps = 4) { var ep = NetworkEndPoint.LoopbackIpv4; ep.Port = 7979; ServerWorld.GetExistingSystem <NetworkStreamReceiveSystem>().Listen(ep); ClientWorld.GetExistingSystem <NetworkStreamReceiveSystem>().Connect(ep); while (TryGetSingletonEntity <NetworkIdComponent>(ClientWorld) == Entity.Null) { if (maxSteps <= 0) { return(false); } --maxSteps; Tick(dt); } return(true); }