private void UnloadNavMesh(int navMeshInt) { NavigationMesh navMesh = Serializer.returnComponent <NavigationMesh> (navMeshInt); if (navMesh && KickStarter.sceneSettings && KickStarter.sceneSettings.navigationMethod != AC_NavigationMethod.UnityNavigation) { if (KickStarter.sceneSettings.navMesh) { NavigationMesh oldNavMesh = KickStarter.sceneSettings.navMesh; oldNavMesh.TurnOff(); } //navMesh.collider.GetComponent <NavigationMesh>().TurnOn (); navMesh.TurnOn(); KickStarter.sceneSettings.navMesh = navMesh; } }
private void UnloadNavMesh(int navMeshInt, SceneSettings sceneSettings) { NavigationMesh navMesh = Serializer.returnComponent <NavigationMesh> (navMeshInt, sceneSettings.gameObject); if (navMesh && sceneSettings && sceneSettings.navigationMethod != AC_NavigationMethod.UnityNavigation) { if (sceneSettings.navMesh) { NavigationMesh oldNavMesh = sceneSettings.navMesh; oldNavMesh.TurnOff(); } navMesh.TurnOn(); sceneSettings.navMesh = navMesh; // Bugfix: Need to cycle this otherwise weight caching doesn't always work navMesh.TurnOff(); navMesh.TurnOn(); } }
override public float Run() { if (sceneSetting == SceneSetting.DefaultNavMesh) { if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider && changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles && hole != null) { NavigationMesh currentNavMesh = KickStarter.sceneSettings.navMesh; if (holeAction == InvAction.Add) { currentNavMesh.AddHole(hole); } else if (holeAction == InvAction.Remove) { currentNavMesh.RemoveHole(hole); } else if (holeAction == InvAction.Replace) { currentNavMesh.AddHole(hole); currentNavMesh.RemoveHole(replaceHole); } } else if (newNavMesh != null) { NavigationMesh oldNavMesh = KickStarter.sceneSettings.navMesh; oldNavMesh.TurnOff(); newNavMesh.TurnOn(); KickStarter.sceneSettings.navMesh = newNavMesh; // Bugfix: Need to cycle this otherwise weight caching doesn't always work newNavMesh.TurnOff(); newNavMesh.TurnOn(); if (newNavMesh.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new NavMesh with no ConstantID - change will not be recognised by saved games."); } } } else if (sceneSetting == SceneSetting.DefaultPlayerStart && playerStart) { KickStarter.sceneSettings.defaultPlayerStart = playerStart; if (playerStart.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new default PlayerStart with no ConstantID - change will not be recognised by saved games."); } } else if (sceneSetting == SceneSetting.SortingMap && sortingMap) { KickStarter.sceneSettings.sortingMap = sortingMap; KickStarter.sceneSettings.UpdateAllSortingMaps(); if (sortingMap.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new SortingMap with no ConstantID - change will not be recognised by saved games."); } } else if (sceneSetting == SceneSetting.TintMap && tintMap) { KickStarter.sceneSettings.tintMap = tintMap; // Reset all FollowSortingMap components FollowTintMap[] followTintMaps = FindObjectsOfType(typeof(FollowTintMap)) as FollowTintMap[]; foreach (FollowTintMap followTintMap in followTintMaps) { followTintMap.ResetTintMap(); } if (tintMap.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new TintMap with no ConstantID - change will not be recognised by saved games."); } } else if (sceneSetting == SceneSetting.OnLoadCutscene) { KickStarter.sceneSettings.cutsceneOnLoad = cutscene; if (cutscene.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to Cutscene On Load with no ConstantID - change will not be recognised by saved games."); } } else if (sceneSetting == SceneSetting.OnStartCutscene) { KickStarter.sceneSettings.cutsceneOnStart = cutscene; if (cutscene.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to Cutscene On Start with no ConstantID - change will not be recognised by saved games."); } } return(0f); }
override public float Run() { if (sceneSetting == SceneSetting.DefaultNavMesh) { if (sceneSettings.navigationMethod == AC_NavigationMethod.PolygonCollider && changeNavMeshMethod == ChangeNavMeshMethod.ChangeNumberOfHoles && hole != null) { NavigationMesh currentNavMesh = sceneSettings.navMesh; if (holeAction == InvAction.Add) { currentNavMesh.AddHole(hole); } else if (holeAction == InvAction.Remove) { currentNavMesh.RemoveHole(hole); } else if (holeAction == InvAction.Replace) { currentNavMesh.AddHole(hole); currentNavMesh.RemoveHole(replaceHole); } } else if (newNavMesh != null) { NavigationMesh oldNavMesh = sceneSettings.navMesh; oldNavMesh.TurnOff(); newNavMesh.TurnOn(); sceneSettings.navMesh = newNavMesh; // Bugfix: Need to cycle this otherwise weight caching doesn't always work newNavMesh.TurnOff(); newNavMesh.TurnOn(); if (newNavMesh.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new NavMesh with no ConstantID - change will not be recognised by saved games.", newNavMesh); } } // Recalculate pathfinding characters foreach (Char _character in KickStarter.stateHandler.Characters) { _character.RecalculateActivePathfind(); } } else if (sceneSetting == SceneSetting.DefaultPlayerStart && playerStart) { sceneSettings.defaultPlayerStart = playerStart; if (playerStart.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new default PlayerStart with no ConstantID - change will not be recognised by saved games.", playerStart); } } else if (sceneSetting == SceneSetting.SortingMap && sortingMap) { sceneSettings.sortingMap = sortingMap; sceneSettings.UpdateAllSortingMaps(); if (sortingMap.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new SortingMap with no ConstantID - change will not be recognised by saved games.", sortingMap); } } else if (sceneSetting == SceneSetting.TintMap && tintMap) { sceneSettings.tintMap = tintMap; // Reset all FollowSortingMap components FollowTintMap[] followTintMaps = FindObjectsOfType(typeof(FollowTintMap)) as FollowTintMap[]; foreach (FollowTintMap followTintMap in followTintMaps) { followTintMap.ResetTintMap(); } if (tintMap.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to new TintMap with no ConstantID - change will not be recognised by saved games.", tintMap); } } else if (sceneSetting == SceneSetting.OnLoadCutscene) { sceneSettings.cutsceneOnLoad = cutscene; if (sceneSettings.actionListSource == ActionListSource.AssetFile) { ACDebug.LogWarning("Warning: As the Scene Manager relies on asset files for its cutscenes, changes made with the 'Scene: Change setting' Action will not be felt."); } else if (cutscene != null && cutscene.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to Cutscene On Load with no ConstantID - change will not be recognised by saved games.", cutscene); } } else if (sceneSetting == SceneSetting.OnStartCutscene) { sceneSettings.cutsceneOnStart = cutscene; if (sceneSettings.actionListSource == ActionListSource.AssetFile) { ACDebug.LogWarning("Warning: As the Scene Manager relies on asset files for its cutscenes, changes made with the 'Scene: Change setting' Action will not be felt."); } else if (cutscene != null && cutscene.GetComponent <ConstantID>() == null) { ACDebug.LogWarning("Warning: Changing to Cutscene On Start with no ConstantID - change will not be recognised by saved games.", cutscene); } } return(0f); }