lvjincheng 4 years ago
parent
commit
907f31ac49

+ 2 - 0
Assets/BowArrow/Scripts/Game/BowCamera.cs

@@ -30,6 +30,8 @@ public class BowCamera : MonoBehaviour
         if (GameMgr.debugInEditor) {
             this.eualrAngles.x = Mathf.Clamp(this.eualrAngles.x - this.mouseSensitivity * Input.GetAxis("Mouse Y"), -36, 36);
             this.eualrAngles.y = Mathf.Clamp(this.eualrAngles.y + this.mouseSensitivity * Input.GetAxis("Mouse X"), -20, 20);   
+            // this.eualrAngles.x = this.eualrAngles.x - this.mouseSensitivity * Input.GetAxis("Mouse Y");
+            // this.eualrAngles.y = this.eualrAngles.y + this.mouseSensitivity * Input.GetAxis("Mouse X");   
             this.transform.eulerAngles = this.eualrAngles; 
             if (EventSystem.current.IsPointerOverGameObject())
             {

+ 10 - 1
Assets/BowArrow/Scripts/Game/TargetDistanceLabel.cs

@@ -10,17 +10,26 @@ public class TargetDistanceLabel : MonoBehaviour
     public Transform followTarget;
     TargetBody targetBody;
     Vector3 centerPoint = new Vector3(0.5f, 0.5f, 0);
+    Text textComp;
     void Start()
     {
         targetBody = GameObject.Find("GameArea/010").GetComponentInChildren<TargetBody>();
+        textComp = this.GetComponent<Text>();
     }
     void LateUpdate()
     {
+        float angle = Vector3.Angle(mainCamera.transform.forward, followTarget.position - mainCamera.transform.position);
+        if (angle > 90) {
+            textComp.enabled = false;
+            return;
+        } else {
+            textComp.enabled = true;
+        }
         Vector3 v3 = mainCamera.WorldToViewportPoint(followTarget.position) - centerPoint;
         v3.x *= canvasRTF.rect.width;
         v3.y *= canvasRTF.rect.height;
         v3.z = 0;
         this.transform.localPosition = v3;
-        this.GetComponent<Text>().text = ((int)Mathf.Round(targetBody.GetDistance())) + "M";
+        textComp.text = ((int)Mathf.Round(targetBody.GetDistance())) + "M";
     }
 }