示例#1
0
	public void SaveAsNavigable()
	{
		navigableInfo = new MapReachableInfos(frees);
	}
示例#2
0
	public void SetAsReachable()
	{
		reachableInfo = new MapReachableInfos(frees);
	}
示例#3
0
	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));
	}
示例#4
0
	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));
	}
示例#5
0
文件: HMapSaver.cs 项目: fengqk/Art
	public static void SaveRechable(MapReachableInfos rechable, string fullPath)
	{
		
	}