private byte[] SerializeNodeLinks() { MemoryStream memoryStream = new MemoryStream(); NodeLink2.SerializeReferences(new GraphSerializationContext(new BinaryWriter(memoryStream))); return(memoryStream.ToArray()); }
private void BuildNodeLinks(GridNode gridNode, GridGraph levelGraph) { int nodeX = gridNode.XCoordinateInGrid; int nodeZ = gridNode.ZCoordinateInGrid; for (int x = nodeX - 1; x < nodeX + 2; x++) { for (int z = nodeZ - 1; z < nodeZ + 2; z++) { GridNode subNode = levelGraph.GetNode(x, z) as GridNode; if (subNode == null) { continue; } if (!subNode.Walkable) { continue; } if (Mathf.Abs(gridNode.position.y - subNode.position.y) == 1000) { Transform linkObject = Instantiate(linkPrefab, (Vector3)gridNode.position, Quaternion.identity); NodeLink2 nodeLink = linkObject.GetComponent <NodeLink2>(); GameObject endPoint = new GameObject("end"); endPoint.transform.position = (Vector3)subNode.position; endPoint.transform.SetParent(linkObject, true); nodeLink.end = endPoint.transform; linkObject.SetParent(transform); nodeLinks.Add(nodeLink); } } } }
private void BuildNodeLinks(GridNode gridNode) { GameObject linkObject = new GameObject("nodeLink"); linkObject.transform.position = (Vector3)gridNode.position; int nodeX = gridNode.XCoordinateInGrid; int nodeZ = gridNode.ZCoordinateInGrid; for (int x = nodeX - 1; x < nodeX + 2; x++) { for (int z = nodeZ - 1; z < nodeZ + 2; z++) { GridNode subNode = levelGraph.GetNode(x, z) as GridNode; if (subNode == null) { continue; } if (Mathf.Abs(gridNode.position.y - subNode.position.y) == 1) { NodeLink2 nodeLink = linkObject.AddComponent <NodeLink2>(); GameObject endPoint = new GameObject("end"); endPoint.transform.position = (Vector3)subNode.position; endPoint.transform.SetParent(linkObject.transform, true); nodeLink.end = endPoint.transform; } } } }
byte[] SerializeNodeLinks() { var stream = new MemoryStream(); var writer = new BinaryWriter(stream); var ctx = new GraphSerializationContext(writer); NodeLink2.SerializeReferences(ctx); return(stream.ToArray()); }
private void DeserializeNodeLinks(GraphNode[] int2Node) { ZipEntry entry = this.GetEntry("node_link2.binary"); if (entry == null) { return; } NodeLink2.DeserializeReferences(new GraphSerializationContext(AstarSerializer.GetBinaryReader(entry), int2Node, 0u, this.meta)); }
private byte[] SerializeNodeLinks() { var stream = new MemoryStream(); #if !ASTAR_NO_LINKS var writer = new BinaryWriter(stream); var ctx = new GraphSerializationContext(writer); NodeLink2.SerializeReferences(ctx); #endif return(stream.ToArray()); }
private void DeserializeNodeLinks(GraphNode[] int2Node) { ZipEntry zipEntry = this.zip["node_link2.binary"]; if (zipEntry == null) { return; } BinaryReader binaryReader = AstarSerializer.GetBinaryReader(zipEntry); GraphSerializationContext ctx = new GraphSerializationContext(binaryReader, int2Node, 0u, this.meta); NodeLink2.DeserializeReferences(ctx); }
void DeserializeNodeLinks(GraphNode[] int2Node) { var entry = GetEntry("node_link2" + binaryExt); if (entry == null) { return; } var reader = GetBinaryReader(entry); var ctx = new GraphSerializationContext(reader, int2Node, 0, meta); NodeLink2.DeserializeReferences(ctx); }