Explorar el Código

修复瞄准空处的bug

lvjincheng hace 4 años
padre
commit
37c7c3d472
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      Assets/BowArrow/Scripts/Game/Arrow.cs

+ 1 - 1
Assets/BowArrow/Scripts/Game/Arrow.cs

@@ -29,7 +29,7 @@ public class Arrow : MonoBehaviour
         } 
 
         //瞄准靶子发射时,自动调整仰角
-        if (raycastHit.transform.gameObject.name == "TargetBody") {
+        if (raycastHit.transform && raycastHit.transform.gameObject.name == "TargetBody") {
             ApplyParabolaAngle(raycastHit.point);            
             float distance = TargetBody.ins.GetDistance();
             if (Mathf.RoundToInt(distance) >= 50) {