public void Update(IServerContext serverContext, IUpdateContext updateContext) { UpdateFrames(); if (serverContext.World != _currentServerWorld || _shadowWorld == null) { if (_shadowWorld != null) { _shadowWorld.Dispose(); } _shadowWorld = _networkFactory.CreateShadowWorld(); _currentServerWorld = serverContext.World; _shadowWorld.OnMessageRecievedStatisticsAction += OnMessageRecievedStatisticsAction; } if (_serverDispatcherChanged.ContainsKey(serverContext.World) && _serverDispatcherChanged[serverContext.World]) { _shadowWorld.Dispatcher = _serverDispatchers[serverContext.World]; _serverDispatcherChanged[serverContext.World] = false; _currentDispatchers[0] = _shadowWorld.Dispatcher; } using (_profiler.Measure("net-step")) { _shadowWorld.Update(serverContext, updateContext); } }
/// <summary> /// Handles the beginning of a step, switching out the current world for <see cref="_nextWorld"/> /// if required. /// </summary> public void Begin() { if (_nextWorld != null) { World?.Dispose(); World = _nextWorld; _nextWorld = null; } }
public DefaultServerContext( IKernel kernel, Server server, IServerWorld world, IServerWorldManager worldManager) { this.m_Kernel = kernel; this.Server = server; this.World = world; this.WorldManager = worldManager; this.Tick = 0; }
public DefaultServerContext( IKernel kernel, Server server, IServerWorld world, IServerWorldManager worldManager) { _kernel = kernel; Server = server; World = world; WorldManager = worldManager; GameTime = new GameTime(); Tick = 0; }
public void Update(IServerContext serverContext, IUpdateContext updateContext) { if (serverContext.World != _currentServerWorld || _shadowWorld == null) { if (_shadowWorld != null) { _shadowWorld.Dispose(); } _shadowWorld = _physicsFactory.CreateShadowWorld(); _currentServerWorld = serverContext.World; } using (_profiler.Measure("phys-step")) { _shadowWorld.Update(serverContext, updateContext); } }
public void AttachDispatcher(IServerWorld world, MxDispatcher dispatcher) { _serverDispatchers[world] = dispatcher; _serverDispatcherChanged[world] = true; }
public static IEnumerable <IServerEntity> GetEntitiesForWorld(this IServerWorld world, IHierarchy hierarchy) { return(hierarchy.Lookup(world).Children.Select(x => x.UntypedValue).OfType <IServerEntity>()); }
/// <summary> /// The switch world. /// </summary> /// <param name="world"> /// The world. /// </param> /// <typeparam name="T"> /// </typeparam> public void SwitchWorld <T>(T world) where T : IServerWorld { _nextWorld = world; }
/// <summary> /// The switch world. /// </summary> /// <param name="creator"> /// The creator. /// </param> /// <typeparam name="TFactory"> /// </typeparam> public void SwitchWorld <TFactory>(Func <TFactory, IServerWorld> creator) { _nextWorld = CreateWorld(creator); }
/// <summary> /// The switch world. /// </summary> /// <typeparam name="T"> /// </typeparam> public void SwitchWorld <T>() where T : IServerWorld { _nextWorld = CreateWorld <T>(); }