From 4185b6324db728bf64e91a52b17ad1a93cc53686 Mon Sep 17 00:00:00 2001 From: starfi5h <50672801+starfi5h@users.noreply.github.com> Date: Sun, 10 Mar 2024 13:37:26 +0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Chris Yeninas <844685+PhantomGamers@users.noreply.github.com> --- NebulaWorld/Player/GizmoManager.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/NebulaWorld/Player/GizmoManager.cs b/NebulaWorld/Player/GizmoManager.cs index 82045aa48..c028c50d7 100644 --- a/NebulaWorld/Player/GizmoManager.cs +++ b/NebulaWorld/Player/GizmoManager.cs @@ -75,8 +75,10 @@ public void OnUpdate() private static void GetMapPing() { - // Modify from UIGlobemap.TeleportLogic - if (Camera.main == null || GameMain.localPlanet == null) return; + // Modify from UIGlobemap.TeleportLogic + var mainCam = Camera.main; + if (mainCam == null || GameMain.localPlanet == null) return; + if (!Physics.Raycast(mainCam.ScreenPointToRay(Input.mousePosition), out var hitInfo, 800f, 8720, QueryTriggerInteraction.Collide)) return; if (!Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out var hitInfo, 800f, 8720, QueryTriggerInteraction.Collide)) return; var starmap = UIRoot.instance.uiGame.starmap; @@ -128,7 +130,7 @@ private static void GetMapPing() private void UpdateIndicator() { if (GameMain.mainPlayer.gizmo.naviIndicatorGizmo != null - && naviIndicatorGizmo != null) // When main player is navigating to other target, close the exisitng one + && naviIndicatorGizmo != null) // When main player is navigating to other target, close the existing one { indicatorPlayerId = 0; indicatorPlanetId = 0; @@ -159,7 +161,7 @@ private void UpdateIndicator() return; } - // Close gizmos if there is no vaild target + // Close gizmos if there is no valid target indicatorPlayerId = 0; indicatorPlanetId = 0; if (naviIndicatorGizmoStarmap != null)