public static void UnLoad() { Log.Info("LifeCycle.Release() called"); Settings.GameConfig = null; HarmonyExtension.UninstallHarmony(); NodeControllerTool.Remove(); }
public static void Load(LoadMode mode = LoadMode.NewGame) { HelpersExtensions.VERBOSE = false; Log.Info("LifeCycle.Load() called"); CSURUtil.Init(); HarmonyExtension.InstallHarmony(); NodeControllerTool.Create(); if (Settings.GameConfig == null) { switch (mode) { case LoadMode.NewGameFromScenario: case LoadMode.LoadScenario: case LoadMode.LoadMap: // no NC or old NC Settings.GameConfig = GameConfigT.LoadGameDefault; break; default: Settings.GameConfig = GameConfigT.NewGameDefault; break; } } NodeManager.Instance.OnLoad(); SegmentEndManager.Instance.OnLoad(); }
public static void OnLevelLoaded(LoadMode mode) { // after level has been loaded. if (Loaded) { NodeControllerTool.Create(); } }
public static void Unload() { if (!Loaded) { return; //protect against disabling from main menu. } Log.Info("LifeCycle.Unload() called"); HarmonyUtil.UninstallHarmony(HARMONY_ID); Settings.GameConfig = null; NodeControllerTool.Remove(); Loaded = false; }
/// <summary> /// Intersects mouse ray with marker bounds. /// </summary> /// <returns><c>true</c>if mouse ray intersects with marker <c>false</c> otherwise</returns> internal bool IntersectRay() { Camera currentCamera = Camera.main; Ray mouseRay = currentCamera.ScreenPointToRay(Input.mousePosition); NodeControllerTool nctool = NodeControllerTool.Instance; float hitH = nctool.GetAccurateHitHeight(); Vector3 pos = Position; float mouseH = nctool.m_mousePosition.y; if (hitH < mouseH - KianToolBase.MAX_HIT_ERROR) { // For metros use projection on the terrain. pos = TerrainPosition; } else if (hitH - pos.y > KianToolBase.MAX_HIT_ERROR) { // if marker is projected on road plane above then modify its height pos.y = hitH; } Bounds bounds = new Bounds(center: pos, size: Vector3.one * Radius); return(bounds.IntersectRay(mouseRay)); }