예제 #1
0
 private void SyncWithServer()
 {
     Thread.Sleep(TimeSpan.FromSeconds(ServerSyncInterval));
     var diffOut = new WorldDiff(_worldShadow, Globals.World);
     _worldShadow = _worldShadow.Patch(diffOut);
     if (!diffOut.IsEmpty) _visualizationUpdates.Enqueue(diffOut);
     _service.SendWorldPatch(_clientID, diffOut);
     var diffIn = _service.ReceiveWorldPatch(_clientID);
     if (!diffIn.IsEmpty) _visualizationUpdates.Enqueue(diffIn);
     _worldShadow = _worldShadow.Patch(diffIn);
     Globals.World.Set(w => w.Patch(diffIn));
     if (_mission == null)
         _mission = new Mission
         {
             AssignMessage = "Go and find The Planet!\nThere'll be no reward.",
             AssignVolume = new Sphere(Globals.World.Value.Wobs.Values.OfType<Station>().First().Pos, 50),
             CompleteMessage = "You found the correct planet,\nnice!",
             CompleteVolume = new Sphere(Globals.World.Value.Wobs.Values.OfType<Planet>().First().Pos, 80),
         };
 }
예제 #2
0
 private void AssertDiffAndPatch(World world1, World world2, Action<WorldDiff> assertDiff)
 {
     var diff = new WorldDiff(world1, world2);
     assertDiff(diff);
     Assertions.WorldsEqual(world2, world1.Patch(diff));
 }