static void OnGameWorldReceived(Helpers.TcpGameWorld world) { GameWorld.World changes = (GameWorld.World)world.Data.GetValue("changes"); bool addition = (bool)world.Data.GetValue("addition"); Logging.Info($"[Client] Updating GameWorld => " + addition); GameWorld.Client.Instance.UpdateLocalWorld(changes, addition); }
static void Main(string[] args) { SlimDX11Renderer.VoroniRenderer2d renderer = new SlimDX11Renderer.VoroniRenderer2d("Mechanical Crypt Simulation"); m_gameWorld = new GameWorld.World(renderer); Input = new SlimDX11Renderer.InputHandler(); var funcs = new Core.UpdateFunctions(); funcs.AddUpdateFunction(UpdateInput, new TimeSpan(0, 0, 0, 0, 20)); funcs.AddUpdateFunction(m_gameWorld.Tick, new TimeSpan(0, 0, 0, 0, 20)); renderer.Run(funcs); renderer.Dispose(); }
/// <summary> /// [Client/Server] GameWorld message used to update the GameWorld. Can be used by the Server and the Client! /// </summary> /// <param name="worldchanges">GameWorld.Server.CompareWorlds() for Server or a new GameWorld.World with the changes for the client</param> /// <param name="isAddition">If the content from worldchanges should be added or removed from the GameWorld</param> public TcpGameWorld(GameWorld.World worldchanges, bool isAddition) { Header = "gameworld"; Data.Add("addition", isAddition); Data.Add("changes", worldchanges); }