public AstarSerializer(AstarData data, SerializeSettings settings) { this.checksum = uint.MaxValue; this.encoding = new UTF8Encoding(); this.data = data; this.settings = settings; }
void Start() { //arrays are by default passed as references! no special treatment is required for map to act as a reference variable. I checked: it's working. mapTiles = gameObject.GetComponent <GameState>().map; sideLength = mapTiles.GetLength(0); //this offset is crucial: the tilemap has negative values, but the list does not. note that as this is currently set up, only square maps are possible. offset = sideLength / 2; mapBaseVerdancy = new byte [sideLength, sideLength]; resourceDirectory = Directory.GetParent(Directory.GetParent(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location).ToString()).ToString()); if (Path.GetFileName(resourceDirectory.ToString()) == "Build") { resourceDirectory = resourceDirectory.GetDirectories("Proto-RTS_Data/Resources")[0]; } else { resourceDirectory = resourceDirectory.GetDirectories("Assets/Resources")[0]; } if (File.Exists(resourceDirectory.ToString() + storedMapName) == false || remake_tileMap == true) { buildMap(); } loadMap(); AstarPath.active.threadCount = Pathfinding.ThreadCount.AutomaticHighLoad; if (File.Exists(resourceDirectory.ToString() + storedNodesName) == false || remake_navmap == true) { AstarPath.active.data.gridGraph.SetDimensions(sideLength, sideLength, 1); AstarPath.active.data.gridGraph.Scan(); var settings = new Pathfinding.Serialization.SerializeSettings(); settings.nodes = true; File.WriteAllBytes(resourceDirectory.ToString() + storedNodesName, AstarPath.active.data.SerializeGraphs(settings)); } else { AstarPath.active.data.DeserializeGraphs(File.ReadAllBytes(resourceDirectory + storedNodesName)); } shaderGateway = Camera.main.transform.GetChild(0).GetChild(0).GetComponent <ShaderHandler>(); shaderGateway.On(); }
public AstarSerializer(AstarData data, SerializeSettings settings) { this.data = data; this.settings = settings; }
public AstarSerializer(AstarData data) { this.data = data; settings = SerializeSettings.Settings; }
public AstarSerializer(AstarData data) { this.checksum = uint.MaxValue; this.data = data; this.settings = SerializeSettings.Settings; }
public AstarSerializer(AstarData data, SerializeSettings settings, GameObject contextRoot) { this.data = data; this.contextRoot = contextRoot; this.settings = settings; }
/** Main serializer function. * Serializes all graphs to a byte array * A similar function exists in the AstarPathEditor.cs script to save additional info */ public byte[] SerializeGraphs (SerializeSettings settings, out uint checksum) { AstarPath.active.BlockUntilPathQueueBlocked(); var sr = new AstarSerializer(this, settings); sr.OpenSerialize(); SerializeGraphsPart (sr); var bytes = sr.CloseSerialize(); checksum = sr.GetChecksum (); return bytes; }
/** Serializes all graphs settings and optionally node data to a byte array. * \see DeserializeGraphs(byte[]) * \see Pathfinding.Serialization.SerializeSettings */ public byte[] SerializeGraphs (SerializeSettings settings) { uint checksum; return SerializeGraphs (settings, out checksum); }