public JSON.Element SaveState()
 {
     return(JSON.Element.NewObject(new Dictionary <string, JSON.Element>()
     {
         ["paths"] = JSON.Element.NewArray(paths.Select(path => Waypath.ToJSON(path)).ToList())
     }));
 }
 JSON.Element SerializeState()
 {
     return(JSON.Element.NewObject(new Dictionary <string, JSON.Element>()
     {
         ["currentPathIndex"] = JSON.Element.NewNumber(currentPathIndex),
         ["paths"] = JSON.Element.NewArray(paths.Select(path => Waypath.ToJSON(path)).ToList()),
         ["traveler"] = traveller.SaveState()
     }));
 }
Exemple #3
0
 public static JSON.Element ToJSON(Location location)
 {
     return(JSON.Element.NewObject(new Dictionary <string, JSON.Element>()
     {
         ["name"] = JSON.Element.NewString(location.name),
         ["position"] = Vector3Utils.Vector3ToJSON(location.position),
         ["pathsToLocations"] = JSON.Element.NewObject(location.pathsToLocations
                                                       .Select(pathToLocation => new KeyValuePair <string, JSON.Element>(pathToLocation.Key, Waypath.ToJSON(pathToLocation.Value)))
                                                       .ToDictionary(entry => entry.Key, entry => entry.Value)),
     }));
 }