Cannon Shoot SFX

This commit is contained in:
TheDaringDan 2022-05-15 16:48:00 -04:00
parent b7197e7807
commit c1da237e8a
2 changed files with 135 additions and 0 deletions

View File

@ -210,6 +210,10 @@ PrefabInstance:
propertyPath: cannon
value:
objectReference: {fileID: 1100404441491063361}
- target: {fileID: 1832045534445164820, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
propertyPath: audioSource
value:
objectReference: {fileID: 407005441095995345}
- target: {fileID: 6969840675257017921, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
propertyPath: m_LocalScale.y
value: 1
@ -218,6 +222,34 @@ PrefabInstance:
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6969840675499469968, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
propertyPath: m_ActionEvents.Array.size
value: 17
objectReference: {fileID: 0}
- target: {fileID: 6969840675499469968, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
propertyPath: m_ActionEvents.Array.data[14].m_ActionId
value: ce1dffb7-3600-4c58-a12a-ce124ef1ddd0
objectReference: {fileID: 0}
- target: {fileID: 6969840675499469968, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
propertyPath: m_ActionEvents.Array.data[15].m_ActionId
value: 4a73fe5c-a8b1-48a9-8377-e4d9941b4e32
objectReference: {fileID: 0}
- target: {fileID: 6969840675499469968, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
propertyPath: m_ActionEvents.Array.data[16].m_ActionId
value: d392a866-be73-4182-8081-9878fbdc19c8
objectReference: {fileID: 0}
- target: {fileID: 6969840675499469968, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
propertyPath: m_ActionEvents.Array.data[14].m_ActionName
value: Player/Dimension1[/Keyboard/1]
objectReference: {fileID: 0}
- target: {fileID: 6969840675499469968, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
propertyPath: m_ActionEvents.Array.data[15].m_ActionName
value: Player/Dimension2[/Keyboard/2]
objectReference: {fileID: 0}
- target: {fileID: 6969840675499469968, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
propertyPath: m_ActionEvents.Array.data[16].m_ActionName
value: Player/Dimension3[/Keyboard/3]
objectReference: {fileID: 0}
- target: {fileID: 6969840675499469969, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
propertyPath: m_RootOrder
value: 0
@ -285,6 +317,107 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 1530449394259395294, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
m_PrefabInstance: {fileID: 1907366388580565151}
m_PrefabAsset: {fileID: 0}
--- !u!1 &8845503654399814665 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6969840675499469974, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
m_PrefabInstance: {fileID: 1907366388580565151}
m_PrefabAsset: {fileID: 0}
--- !u!82 &407005441095995345
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8845503654399814665}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 58db08c1de711734587c1dfa42bb1754, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 1
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!4 &8845503654399814670 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6969840675499469969, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}

View File

@ -17,6 +17,7 @@ public class CannonScript : MonoBehaviour
private Vector3 lookDir;
private Vector3[] offsets;
[SerializeField]private int bullets;
[SerializeField] private AudioSource audioSource;
// Start is called before the first frame update
void Start()
@ -48,6 +49,7 @@ public class CannonScript : MonoBehaviour
proj.GetComponent<Projectile>().SetDamage(damage);
proj.GetComponent<Rigidbody>().AddForce(cannonForce * lookDir, ForceMode.Impulse);
proj.layer = GameManager.Instance.GetCurrentLayerID();
SoundManager.Instance.PlaySfx(audioSource);
RaycastHit hit;
if (Physics.Raycast(transform.position, lookDir, out hit, Mathf.Infinity, GameManager.Instance.GetCurrentDimensionLayerMask()))
{