public bool LoadNavMesh(string mapName) { bool retCode = false; string path = ConfigFileDir + mapName + ".bytes"; NavMeshInfo navInfo = MapMgr.Inst().GetNavMeshInfo(mapName); if (navInfo == null) { retCode = LoadNavMeshByJsonFile(path, ref m_MapNavMesh); if (MapNavMesh == null || retCode == false) { Console.WriteLine("LoadNavMeshByJsonFile {0} failed", path); return(false); } m_MapNavMeshQuery = new NavMeshQuery(); m_MapNavMeshQuery.Init(MapNavMesh, (int)MapDefine.MAX_NAV_POLYS); NavMeshInfo newNavInfo = new NavMeshInfo(); newNavInfo.pdtNavMesh = MapNavMesh; newNavInfo.pdtNavMeshQuery = MapNavMeshQuery; MapMgr.Inst().AddNavMeshInfo(mapName, newNavInfo); } else { m_MapNavMesh = navInfo.pdtNavMesh; m_MapNavMeshQuery = navInfo.pdtNavMeshQuery; } return(true); }
public void AddNavMeshInfo(string navName, NavMeshInfo navInfo) { if (NavMeshMap.ContainsKey(navName) || navInfo == null) { Console.WriteLine("{0} is exist in the MapMgr!", navName); return; } NavMeshMap[navName] = navInfo; }