|
|
@@ -22,6 +22,7 @@ public class ArrowSync : MonoBehaviour
|
|
|
|
|
|
Quaternion rotation;
|
|
|
Vector3 position;
|
|
|
+ bool hasPlayHitAudio = false;
|
|
|
[System.NonSerialized] public bool isHit;
|
|
|
[System.NonSerialized] public bool canUseSideCamera;
|
|
|
[System.NonSerialized] public bool hasSetSyncData = false; //外部运算用的
|
|
|
@@ -46,6 +47,18 @@ public class ArrowSync : MonoBehaviour
|
|
|
//射出的声音
|
|
|
AudioMgr.ins.PlayShoot(AudioMgr.GetAudioSource(this.gameObject));
|
|
|
}
|
|
|
+ if (isHit && !hasPlayHitAudio) {
|
|
|
+ hasPlayHitAudio = true;
|
|
|
+ int hitType = syncData.ht;
|
|
|
+ if (hitType == 1 || hitType == 2) {
|
|
|
+ AudioMgr.ins.PlayHit(AudioMgr.GetAudioSource(TargetBody.ins.gameObject));
|
|
|
+ AudioMgr.ins.PlayCheer(hitType == 1 ? true : false);
|
|
|
+ } else if (hitType == 4 || hitType == 5) {
|
|
|
+ AudioMgr.ins.PlayArrowEnter();
|
|
|
+ } else if (hitType == 3) {
|
|
|
+ AudioMgr.ins.PlayCheer(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public class SyncData {
|
|
|
@@ -61,6 +74,7 @@ public class ArrowSync : MonoBehaviour
|
|
|
public float pz;
|
|
|
public bool cs;
|
|
|
public bool ih;
|
|
|
+ public int ht;
|
|
|
public void SetData(Arrow arrow) {
|
|
|
Quaternion r = arrow.transform.rotation;
|
|
|
Vector3 p = arrow.Head().transform.position;
|
|
|
@@ -73,6 +87,7 @@ public class ArrowSync : MonoBehaviour
|
|
|
pz = p.z;
|
|
|
cs = arrow.canUseSideCamera;
|
|
|
ih = arrow.isHit;
|
|
|
+ ht = arrow.hitType;
|
|
|
if (!inited) {
|
|
|
id = autoID++;
|
|
|
if (autoID > 1000) autoID = 0;
|