lvjincheng пре 3 година
родитељ
комит
1ad656f840

+ 12 - 9
Assets/BowArrow/Scripts/Game/Arrow.cs

@@ -296,7 +296,15 @@ public class Arrow : MonoBehaviour
         }
     }
 
-    [NonSerialized] public int hitType = 0;
+    public class HitType
+    {
+        public static int None = 0;
+        public static int TargetInRing = 1; //击中了靶子,且在得分环内
+        public static int TargetOutRing = 2; //击中了靶子,但不在得分环内
+        public static int NotTarget = 4; //击中非目标对象
+        public static int Animal = 5; //击中动物
+    }
+    [NonSerialized] public int hitType = HitType.None;
     [NonSerialized] public Transform raycastHitTransform; //射线击中的目标变换
     [NonSerialized] public string[] hitTargetAnimalInfo; 
     //飞行逻辑中检测到碰撞
@@ -314,7 +322,7 @@ public class Arrow : MonoBehaviour
             this.arrowCameraComp.arrowCameraTemplate?.beforeHit();
             raycastHit.transform.GetComponent<TargetBody>().Hit(this, hitPoint);
         } else if (targetName.StartsWith("TargetAnimalPart")) {
-            hitType = 5;
+            hitType = HitType.Animal;
             Vector3 hitPoint = raycastHit.point;
             string partName = targetName.Split(new char[]{'_'})[1];
             this.arrowCameraComp.arrowCameraTemplate?.beforeHit();
@@ -338,13 +346,8 @@ public class Arrow : MonoBehaviour
             Hit();
             GameMgr.ins.gameMode.HitTarget(0);
             //击中其它东西时的音效
-            if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "GameChallenge") {
-                hitType = 4;
-                AudioMgr.ins.PlayArrowEnter();
-            } else {
-                hitType = 3;
-                AudioMgr.ins.PlayCheer(false);
-            }
+            hitType = HitType.NotTarget;
+            AudioMgr.ins.PlayArrowEnter();
         }
     }
 

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

@@ -39,7 +39,7 @@ public class TargetBody : MonoBehaviour
             GameMgr.ins.gameMode.HitTarget(0);
             AudioMgr.ins.PlayCheer(false);
         }
-        arrow.hitType = hitTarget ? 1 : 2; 
+        arrow.hitType = hitTarget ? Arrow.HitType.TargetInRing : Arrow.HitType.TargetOutRing; 
     }
 
     float measureRadius(Vector3 position) {

+ 1 - 1
Assets/BowArrow/Scripts/Manager/AudioMgr.cs

@@ -49,7 +49,7 @@ public class AudioMgr : MonoBehaviour
     }
 
     public void PlayCheer(bool cheer) {
-        this.Play("Audios/" + (cheer ? "喝彩" : "喝倒彩"), null);
+        //this.Play("Audios/" + (cheer ? "喝彩" : "喝倒彩"), null);
     }
 
     public void PlayBtn() {