void Start() { #region Check availability of toolbar if (ToolbarManager.ToolbarAvailable) { _button = ToolbarManager.Instance.add("NavHud", "NavHudButton"); _button.TexturePath = "NavHud/ToolbarIcon"; _button.ToolTip = "NavBall HUD"; _button.OnClick += (e) => _mainWindowVisible = !_mainWindowVisible; _toolbarAvailable = true; } else { if (ApplicationLauncher.Ready) { OnGUIAppLauncherReady(); } else { GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady); } } #endregion // People kept hitting time acceleration by accident, so moved middle-ish. _mainWindowPosition = new Rect(Screen.width / 3, Screen.height / 6, 10, 10); _colorWindowPosition = new Rect(Screen.width / 2, Screen.height / 2, 10, 10); _hudTextWindowPosition = new Rect(Screen.width / 2 - 20.0f, Screen.height * 0.7f, 10, 10); Load(); #region Setup hud camera GameObject hudCameraGameObject = new GameObject("HUDCamera"); _hudCam = hudCameraGameObject.AddComponent <Camera>(); _hudCam.transform.position = Vector3.zero; _hudCam.transform.rotation = Quaternion.identity; _hudCam.name = "HUDCamera"; _hudCam.clearFlags = CameraClearFlags.Nothing; _hudCam.cullingMask = (1 << 7); _hudCam.depth = 1; #endregion #region Setup MainBehaviour _behaviour = _hudCam.gameObject.AddComponent <MainBehaviour>(); _behaviour.HudCam = _hudCam; _behaviour.Values = _values; _behaviour.Enabled = _enabled; _behaviour.LinesEnabled = _linesEnabled; _behaviour.MarkersEnabled = _markersEnabled; //_behaviour.WaypointEnabled = _waypointEnabled; // Broken 1.1.3 waypoint code _behaviour.EnabledMap = _enableMap; #endregion GameEvents.onShowUI.Add(showUI); GameEvents.onHideUI.Add(hideUI); }
void Start() { #region Check availability of toolbar if (ToolbarManager.ToolbarAvailable) { _button = ToolbarManager.Instance.add("NavHud", "NavHudButton"); _button.TexturePath = "NavHud/ToolbarIcon"; _button.ToolTip = "NavBall HUD"; _button.OnClick += (e) => _mainWindowVisible = !_mainWindowVisible; _toolbarAvailable = true; } else{ if (ApplicationLauncher.Ready) { OnGUIAppLauncherReady(); } else { GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady); } } #endregion // People kept hitting time acceleration by accident, so moved middle-ish. _mainWindowPosition = new Rect(Screen.width / 3, Screen.height / 6, 10, 10); _colorWindowPosition = new Rect(Screen.width / 2, Screen.height / 2, 10, 10); _hudTextWindowPosition = new Rect(Screen.width / 2 - 20.0f, Screen.height * 0.7f, 10, 10); Load(); #region Setup hud camera GameObject hudCameraGameObject = new GameObject("HUDCamera"); _hudCam = hudCameraGameObject.AddComponent<Camera>(); _hudCam.transform.position = Vector3.zero; _hudCam.transform.rotation = Quaternion.identity; _hudCam.name = "HUDCamera"; _hudCam.clearFlags = CameraClearFlags.Nothing; _hudCam.cullingMask = (1 << 5); _hudCam.depth = 1; #endregion #region Setup MainBehaviour _behaviour = _hudCam.gameObject.AddComponent<MainBehaviour>(); _behaviour.HudCam = _hudCam; _behaviour.Values = _values; _behaviour.Enabled = _enabled; _behaviour.LinesEnabled = _linesEnabled; _behaviour.MarkersEnabled = _markersEnabled; _behaviour.WaypointEnabled = _waypointEnabled; _behaviour.EnabledMap = _enableMap; #endregion RenderingManager.AddToPostDrawQueue(0, OnGui); GameEvents.onShowUI.Add(showUI); GameEvents.onHideUI.Add(hideUI); }