Ejemplo n.º 1
0
	//---------------------------------------------------------------------
	/* Function */
	//---------------------------------------------------------------------	
		

	public bool LoadNavMesh( int iIndex )
	{		
		if (true == m_NavMeshList.ContainsKey(iIndex))
        {
			//Debug.LogError("NavMeshFinder::LoadNavMesh()[ true == m_NavMeshList.ContainsKey(iID) ] index  : " + iIndex );
			//Debug.Log("loaded map index");
			return true;
		}
		
		string strPath = "PathFinder/" + iIndex.ToString();
		try
		{
			
			TextAsset xmlText = Resources.Load(strPath) as TextAsset;			
			if( null == xmlText )
			{
				Debug.LogError("NavMeshFinder::LoadNavMesh()[ path : " + strPath );
				return false;
			}	
			DetourStatNavMesh nav = new DetourStatNavMesh();			
	
			if( false == nav.init( xmlText.bytes, xmlText.bytes.Length, true, iIndex ) )
			{
				Debug.LogError("NavMeshFinder::LoadNavMesh()[ nav.init() == false ] index : " + iIndex );
				return false;
			}
			
			m_NavMeshList.Add( iIndex, nav );
		}
		catch(System.Exception e)
		{
			Debug.LogError("NavMeshFinder::LoadNavMesh() : " + e.ToString() );
		}
		
		
		
		return true;		
	}
Ejemplo n.º 2
0
	public void SetNavMesh( int iIndex )
	{
		if( null != m_curNavMesh )
		{
			if( m_curNavMesh.index == iIndex )
			{
				Debug.LogWarning("NavMeshFinder::SetNavMesh()[ m_curNavMesh.index == iIndex ] index : " + iIndex );
				return;
			}
		}
		
		if (false == m_NavMeshList.ContainsKey(iIndex))
        {
			Debug.LogError("NavMeshFinder::SetNavMesh()[ false == m_NavMeshList.ContainsKey(iIndex) ] index  : " + iIndex );
			return;
		}
		
		m_curNavMesh = m_NavMeshList[iIndex];	
		if( null == m_curNavMesh )
		{
			AsUtil.ShutDown("NavMeshFinder::SetNavMesh()[ null == m_curNavMesh] index : " + iIndex );
		}
	}