一.MapScene中初始化NavMeshFaceID与TerrainType
public TerrainType GetFaceTerrainType(PathFaceRecord navMeshFace){switch (navMeshFace.FaceGroupIndex){case 1:return TerrainType.Plain;case 2:return TerrainType.Desert;case 3:return TerrainType.Snow;case 4:return TerrainType.Forest;case 5:return TerrainType.Steppe;case 6:return TerrainType.Fording;case 7:return TerrainType.Mountain;case 8:return TerrainType.Lake;case 10:return TerrainType.Water;case 11:return TerrainType.River;case 13:return TerrainType.Canyon;case 14:return TerrainType.RuralArea;}return TerrainType.Plain;}
二.MapScene中判定TerrainType是否能行走
public void DisableUnwalkableNavigationMeshes(){this.Scene.SetAbilityOfFacesWithId(MapScene.GetNavigationMeshIndexOfTerrainType(TerrainType.Mountain), false);this.Scene.SetAbilityOfFacesWithId(MapScene.GetNavigationMeshIndexOfTerrainType(TerrainType.Lake), false);this.Scene.SetAbilityOfFacesWithId(MapScene.GetNavigationMeshIndexOfTerrainType(TerrainType.Water), false);this.Scene.SetAbilityOfFacesWithId(MapScene.GetNavigationMeshIndexOfTerrainType(TerrainType.River), false);this.Scene.SetAbilityOfFacesWithId(MapScene.GetNavigationMeshIndexOfTerrainType(TerrainType.Canyon), false);this.Scene.SetAbilityOfFacesWithId(MapScene.GetNavigationMeshIndexOfTerrainType(TerrainType.RuralArea), false);}
三.大地图场景MapScene加载
大地图场景SceneObj目录:SandBox/SceneObj/Main_map