/** * Sets up the scene's chosen NavigationEngine ScriptableObject if it is not already present. */ public void ResetEngine() { string className = ""; if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.Custom) { className = KickStarter.sceneSettings.customNavigationClass; } else { className = "NavigationEngine_" + KickStarter.sceneSettings.navigationMethod.ToString (); } if (className == "" && Application.isPlaying) { ACDebug.LogWarning ("Could not initialise navigation - a custom script must be assigned if the Pathfinding method is set to Custom."); } else if (navigationEngine == null || !navigationEngine.ToString ().Contains (className)) { navigationEngine = (NavigationEngine) ScriptableObject.CreateInstance (className); if (navigationEngine != null) { navigationEngine.OnReset (KickStarter.sceneSettings.navMesh); } } }
/** * Sets up the scene's chosen NavigationEngine ScriptableObject if it is not already present. */ public void ResetEngine() { string className = ""; if (KickStarter.sceneSettings.navigationMethod == AC_NavigationMethod.Custom) { className = KickStarter.sceneSettings.customNavigationClass; } else { className = "NavigationEngine_" + KickStarter.sceneSettings.navigationMethod.ToString(); } if (className == "" && Application.isPlaying) { ACDebug.LogWarning("Could not initialise navigation - a custom script must be assigned if the Pathfinding method is set to Custom."); } else if (navigationEngine == null || !navigationEngine.ToString().Contains(className)) { navigationEngine = (NavigationEngine)ScriptableObject.CreateInstance(className); if (navigationEngine != null) { navigationEngine.OnReset(KickStarter.sceneSettings.navMesh); } } }
public void OnAwake(NavigationMesh defaultNavMesh) { navigationEngine = null; ResetEngine(); // Turn off all NavMesh objects NavigationMesh[] navMeshes = FindObjectsOfType(typeof(NavigationMesh)) as NavigationMesh[]; foreach (NavigationMesh _navMesh in navMeshes) { if (defaultNavMesh != _navMesh) { _navMesh.TurnOff(); } } if (navigationEngine == null || navigationEngine.RequiresNavMeshGameObject) { if (defaultNavMesh != null) { defaultNavMesh.TurnOn(); } else if (navigationEngine != null) { AC.Char[] allChars = FindObjectsOfType(typeof(AC.Char)) as AC.Char[]; if (allChars.Length > 0) { ACDebug.LogWarning("No NavMesh set. Characters will not be able to PathFind until one is defined - please choose one using the Scene Manager."); } } } }
/** * Sets up the scene's chosen NavigationEngine ScriptableObject if it is not already present. */ public void ResetEngine() { if (GetComponent <SceneSettings>()) { string className = "NavigationEngine_" + GetComponent <SceneSettings>().navigationMethod.ToString (); if (navigationEngine == null || !navigationEngine.ToString ().Contains (className)) { navigationEngine = (NavigationEngine) ScriptableObject.CreateInstance (className); navigationEngine.Awake (); } } }
public void ResetEngine() { if (GetComponent <SceneSettings>()) { string className = "NavigationEngine_" + GetComponent <SceneSettings>().navigationMethod.ToString(); if (navigationEngine == null || !navigationEngine.ToString().Contains(className)) { navigationEngine = (NavigationEngine)ScriptableObject.CreateInstance(className); navigationEngine.Awake(); } } }
/** * Initialises the Navigation Engine. This is public so we have control over when it is called in relation to other Awake functions. */ public void OnAwake() { navigationEngine = null; ResetEngine(); }
private void Awake() { navigationEngine = null; ResetEngine (); }
private void Awake() { navigationEngine = null; ResetEngine(); }
/** * Initialises the Navigation Engine. This is public so we have control over when it is called in relation to other Awake functions. */ public void OnAwake() { navigationEngine = null; ResetEngine (); }