Projectile Shooting Audio Added

This commit is contained in:
Syntriax 2022-02-26 17:57:04 +03:00
parent e80158e77f
commit 3ccc7a24b8
10 changed files with 164 additions and 0 deletions

View File

@ -0,0 +1 @@
1,0.5,,0.0341,,0.1644,0.3,0.7778,,-0.3023,,,,,,,,,,,,,,,,1,,,,,,,masterVolume

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fb45fa637e425ff4c800134e68f9a646
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 45157062ea57f1f4fb2271380bb846e4
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1 @@
1,0.5,,0.1319,,0.1193,0.3,0.4149,0.0348,-0.552,,,,,,,,,,,0.6014,-0.5053,,,,1,,,0.2598,,,,masterVolume

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 82a5f8733e6ab5b42b342641ccdb06e1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 1c6fb63523573864db38a1638bd01635
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -150,3 +150,104 @@ Transform:
m_CorrespondingSourceObject: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3} m_CorrespondingSourceObject: {fileID: 3234632762428300599, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
m_PrefabInstance: {fileID: 3612889356597698756} m_PrefabInstance: {fileID: 3612889356597698756}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &6102515708334491356 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7391517555913877016, guid: c0a2079a443363b4da73a0d425221f6c, type: 3}
m_PrefabInstance: {fileID: 3612889356597698756}
m_PrefabAsset: {fileID: 0}
--- !u!82 &-1472554968350166213
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6102515708334491356}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 8377903610078173799, guid: 55dad93ba7816e44c83798006fa0a277, type: 2}
m_audioClip: {fileID: 8300000, guid: 1c6fb63523573864db38a1638bd01635, 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: 0
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: 0
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

View File

@ -21,6 +21,7 @@ namespace AI
protected bool isShooting = false; protected bool isShooting = false;
protected IMovement movement = null; protected IMovement movement = null;
protected Animator animator = null; protected Animator animator = null;
protected AudioSource audioSource = null;
protected int layerMask = ~(1 << 9); protected int layerMask = ~(1 << 9);
protected bool canShoot => target != null && (target.transform.position - transform.position).sqrMagnitude < attackRangeSquared; protected bool canShoot => target != null && (target.transform.position - transform.position).sqrMagnitude < attackRangeSquared;
@ -44,6 +45,7 @@ namespace AI
{ {
movement = transform.GetComponentInParent<IMovement>(); movement = transform.GetComponentInParent<IMovement>();
animator = transform.GetComponentInParent<Animator>(); animator = transform.GetComponentInParent<Animator>();
audioSource = transform.GetComponentInParent<AudioSource>();
UpdateTarget(FindObjectOfType<Player.PlayerController>()?.transform); UpdateTarget(FindObjectOfType<Player.PlayerController>()?.transform);
} }
@ -90,6 +92,7 @@ namespace AI
projectile.SetVelocity(velocity); projectile.SetVelocity(velocity);
remainingCooldown = cooldownPerShoot; remainingCooldown = cooldownPerShoot;
audioSource.Play();
OnShoot?.Invoke(); OnShoot?.Invoke();
} }