public IEnumerator UpdateNavMeshAndWait() { if (HasBuildOperationStarted || AiManager.nav_disable || !AI.npc_enable) { yield break; } HasBuildOperationStarted = false; Bounds.center = base.transform.position; if (!overrideAutoBounds) { Bounds.size = new Vector3(CellSize * CellCount, Height, CellSize * CellCount); } IEnumerator enumerator = NavMeshTools.CollectSourcesAsync(Bounds, LayerMask, NavMeshCollectGeometry, defaultArea, use_baked_terrain_mesh, CellSize, sources, AppendModifierVolumes, UpdateNavMeshAsync); if (AiManager.nav_wait) { yield return(enumerator); } else { StartCoroutine(enumerator); } if (!AiManager.nav_wait) { UnityEngine.Debug.Log("nav_wait is false, so we're not waiting for the navmesh to finish generating. This might cause your server to sputter while it's generating."); yield break; } int lastPct = 0; while (!HasBuildOperationStarted) { Thread.Sleep(250); yield return(null); } while (BuildingOperation != null) { int num = (int)(BuildingOperation.progress * 100f); if (lastPct != num) { UnityEngine.Debug.LogFormat("{0}%", num); lastPct = num; } Thread.Sleep(250); FinishBuildingNavmesh(); yield return(null); } }
public IEnumerator UpdateNavMeshAndWait() { if (HasBuildOperationStarted || AiManager.nav_disable) { yield break; } HasBuildOperationStarted = false; Bounds.size = TerrainMeta.Size; NavMesh.pathfindingIterationsPerFrame = AiManager.pathfindingIterationsPerFrame; IEnumerator enumerator = NavMeshTools.CollectSourcesAsync(Bounds, LayerMask, NavMeshCollectGeometry, defaultArea, use_baked_terrain_mesh, AsyncTerrainNavMeshBakeCellSize, sources, AppendModifierVolumes, UpdateNavMeshAsync); if (AiManager.nav_wait) { yield return(enumerator); } else { StartCoroutine(enumerator); } if (!AiManager.nav_wait) { UnityEngine.Debug.Log("nav_wait is false, so we're not waiting for the navmesh to finish generating. This might cause your server to sputter while it's generating."); yield break; } int lastPct = 0; while (!HasBuildOperationStarted) { Thread.Sleep(250); yield return(null); } while (BuildingOperation != null) { int num = (int)(BuildingOperation.progress * 100f); if (lastPct != num) { UnityEngine.Debug.LogFormat("{0}%", num); lastPct = num; } Thread.Sleep(250); FinishBuildingNavmesh(); yield return(null); } }