public void SaveAsNavigable() { navigableInfo = new MapReachableInfos(frees); }
public void SetAsReachable() { reachableInfo = new MapReachableInfos(frees); }
public void Load(string levelName, bool skipHeights = false) { string path = GetSavePath(levelName); string fileName = GetSaveFileName(levelName); string fullPath = System.IO.Path.Combine(path, fileName); if (!System.IO.File.Exists(fullPath)) { Debug.LogError(string.Format("File not exists. {0}", fullPath)); return; } float[][] oriHeights = null ; if (skipHeights) { if (hitPositions != null) { oriHeights = new float[hitPositions.Length][]; for ( int i = 0; i < hitPositions.Length; i ++){ oriHeights[i] = new float[hitPositions[i].Length]; } for (int z = 0; z < hitPositions.Length; z++) { for (int x = 0; x < hitPositions[z].Length; x++) { oriHeights[x][z] = hitPositions[x][z].y; } } } else { Debug.Log("先Load,再Sample,最后LoadOnlyReachable"); } } try { heightInfos = ChpLibXML.Load<MapHeightInfos>(fullPath); if (skipHeights) { heightInfos.heights = oriHeights; } } catch { Debug.LogError("Load File Fail."); return; } reachableInfo = new MapReachableInfos(heightInfos.reachables); navigableInfo = new MapReachableInfos(heightInfos.navigable); frees = locType == SampleLocatorType.Reachable ? reachableInfo.reachables : navigableInfo.reachables; hitPositions = CalPosition(heightInfos, Terrain.activeTerrain.GetPosition()); centerPositions = CenterPositionsFromHitPositions(hitPositions); sampleSize = heightInfos.sampleSize; isWayPoints = heightInfos.isWayPoints; Debug.Log(string.Format("File loaded. {0}", fullPath)); }
public void Load(string levelName) { string path = GetSavePath(levelName); string fileName = GetSaveFileName(levelName); string fullPath = System.IO.Path.Combine(path, fileName); if (!System.IO.File.Exists(fullPath)) { Debug.LogError(string.Format("File not exists. {0}", fullPath)); return; } try { heightInfos = ChpLibXML.Load<MapHeightInfos>(fullPath); } catch { Debug.LogError("Load File Fail."); return; } reachableInfo = new MapReachableInfos(heightInfos.reachables); navigableInfo = new MapReachableInfos(heightInfos.navigable); frees = locType == SampleLocatorType.Reachable ? reachableInfo.reachables : navigableInfo.reachables; hitPositions = CalPosition(heightInfos, Terrain.activeTerrain.GetPosition()); centerPositions = CenterPositionsFromHitPositions(hitPositions); sampleSize = heightInfos.sampleSize; Debug.Log(string.Format("File loaded. {0}", fullPath)); }
public static void SaveRechable(MapReachableInfos rechable, string fullPath) { }