|
@@ -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 Transform raycastHitTransform; //射线击中的目标变换
|
|
|
[NonSerialized] public string[] hitTargetAnimalInfo;
|
|
[NonSerialized] public string[] hitTargetAnimalInfo;
|
|
|
//飞行逻辑中检测到碰撞
|
|
//飞行逻辑中检测到碰撞
|
|
@@ -314,7 +322,7 @@ public class Arrow : MonoBehaviour
|
|
|
this.arrowCameraComp.arrowCameraTemplate?.beforeHit();
|
|
this.arrowCameraComp.arrowCameraTemplate?.beforeHit();
|
|
|
raycastHit.transform.GetComponent<TargetBody>().Hit(this, hitPoint);
|
|
raycastHit.transform.GetComponent<TargetBody>().Hit(this, hitPoint);
|
|
|
} else if (targetName.StartsWith("TargetAnimalPart")) {
|
|
} else if (targetName.StartsWith("TargetAnimalPart")) {
|
|
|
- hitType = 5;
|
|
|
|
|
|
|
+ hitType = HitType.Animal;
|
|
|
Vector3 hitPoint = raycastHit.point;
|
|
Vector3 hitPoint = raycastHit.point;
|
|
|
string partName = targetName.Split(new char[]{'_'})[1];
|
|
string partName = targetName.Split(new char[]{'_'})[1];
|
|
|
this.arrowCameraComp.arrowCameraTemplate?.beforeHit();
|
|
this.arrowCameraComp.arrowCameraTemplate?.beforeHit();
|
|
@@ -338,13 +346,8 @@ public class Arrow : MonoBehaviour
|
|
|
Hit();
|
|
Hit();
|
|
|
GameMgr.ins.gameMode.HitTarget(0);
|
|
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();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|