diff --git a/Assets/Audio/Audio Mixer.mixer b/Assets/Audio/Audio Mixer.mixer index 1e93457..4033f3b 100644 --- a/Assets/Audio/Audio Mixer.mixer +++ b/Assets/Audio/Audio Mixer.mixer @@ -61,6 +61,39 @@ AudioMixerGroupController: m_Mute: 0 m_Solo: 0 m_BypassEffects: 0 +--- !u!244 &-671410346139079125 +AudioMixerEffectController: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_EffectID: 34608f7a4d3499e4bb4747a42c281232 + m_EffectName: Attenuation + m_MixLevel: 2dc88c31b1b16cf4a91c0e7082919ee3 + m_Parameters: [] + m_SendTarget: {fileID: 0} + m_EnableWetMix: 0 + m_Bypass: 0 +--- !u!243 &-329335723480019797 +AudioMixerGroupController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Projectile Hit + m_AudioMixer: {fileID: 24100000} + m_GroupID: dd1cda19a45ef294d8789a2af47afcf7 + m_Children: [] + m_Volume: 2cd261abac4698e4698da002d6c5a44a + m_Pitch: 1c7ec7a4f840018488827068ccd5f583 + m_Send: 00000000000000000000000000000000 + m_Effects: + - {fileID: -671410346139079125} + m_UserColorIndex: 0 + m_Mute: 0 + m_Solo: 0 + m_BypassEffects: 0 --- !u!241 &24100000 AudioMixerController: m_ObjectHideFlags: 0 @@ -84,6 +117,7 @@ AudioMixerController: - aec3f58549ce7b4478c453c40c434318 - 88391c573bd80364c916040d855538c8 - 08116dbf9979b7b4d8fcce772ec5ebfc + - dd1cda19a45ef294d8789a2af47afcf7 name: View m_CurrentViewIndex: 0 m_TargetSnapshot: {fileID: 24500006} @@ -174,10 +208,11 @@ AudioMixerGroupController: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Projectile + m_Name: Projectile Shot m_AudioMixer: {fileID: 24100000} m_GroupID: 88391c573bd80364c916040d855538c8 - m_Children: [] + m_Children: + - {fileID: -329335723480019797} m_Volume: 2c4223d0669e7fa4a9bcd208d65d7586 m_Pitch: 204d50d8b21017e41b743bceefd553b6 m_Send: 00000000000000000000000000000000 diff --git a/Assets/Audio/Sound Effects/Projectile Hit.bfxrsound b/Assets/Audio/Sound Effects/Projectile Hit.bfxrsound new file mode 100644 index 0000000..bfc472c --- /dev/null +++ b/Assets/Audio/Sound Effects/Projectile Hit.bfxrsound @@ -0,0 +1 @@ +3,0.5,,0.2297,0.6172,0.1934,0.3,0.0275,,0.1354,,,,,,,,,,,,,,,,1,,,,,,,masterVolume \ No newline at end of file diff --git a/Assets/Audio/Sound Effects/Projectile Hit.bfxrsound.meta b/Assets/Audio/Sound Effects/Projectile Hit.bfxrsound.meta new file mode 100644 index 0000000..ac9cb6f --- /dev/null +++ b/Assets/Audio/Sound Effects/Projectile Hit.bfxrsound.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4aa857170acca284b9ce4bc83d44dd99 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio/Sound Effects/Projectile Hit.wav b/Assets/Audio/Sound Effects/Projectile Hit.wav new file mode 100644 index 0000000..d917e7f Binary files /dev/null and b/Assets/Audio/Sound Effects/Projectile Hit.wav differ diff --git a/Assets/Audio/Sound Effects/Projectile Hit.wav.meta b/Assets/Audio/Sound Effects/Projectile Hit.wav.meta new file mode 100644 index 0000000..4cff908 --- /dev/null +++ b/Assets/Audio/Sound Effects/Projectile Hit.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 59d0430fe628a2a4da8634f4c1e01c9b +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: diff --git a/Assets/Resources/Projectiles/Basic Projectile.prefab b/Assets/Resources/Projectiles/Basic Projectile.prefab index 6fdd225..f482768 100644 --- a/Assets/Resources/Projectiles/Basic Projectile.prefab +++ b/Assets/Resources/Projectiles/Basic Projectile.prefab @@ -14,6 +14,7 @@ GameObject: - component: {fileID: 5084819958108693599} - component: {fileID: 6837629660644296000} - component: {fileID: 2154021251853475818} + - component: {fileID: 4197101675176415021} m_Layer: 9 m_Name: Basic Projectile m_TagString: Untagged @@ -137,7 +138,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1451960c367cc30478631b32ba4f8356, type: 3} m_Name: m_EditorClassIdentifier: - damageOnContact: 50 --- !u!95 &2154021251853475818 Animator: serializedVersion: 4 @@ -158,3 +158,99 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!82 &4197101675176415021 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2196707779812385060} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: -329335723480019797, guid: 55dad93ba7816e44c83798006fa0a277, type: 2} + m_audioClip: {fileID: 8300000, guid: 59d0430fe628a2a4da8634f4c1e01c9b, 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 diff --git a/Assets/Scripts/AI/Projectile.cs b/Assets/Scripts/AI/Projectile.cs index 23fea04..02508da 100644 --- a/Assets/Scripts/AI/Projectile.cs +++ b/Assets/Scripts/AI/Projectile.cs @@ -6,21 +6,24 @@ namespace AI [RequireComponent(typeof(Rigidbody2D))] public class Projectile : MonoBehaviour, IPausable { - private Rigidbody2D _rigidbody = null; + public Rigidbody2D Rigidbody { get; private set; } = null; + private AudioSource audioSource = null; private void Awake() { - _rigidbody = GetComponent(); + Rigidbody = GetComponent(); + audioSource = GetComponent(); } public void SetVelocity(Vector2 velocity) { - _rigidbody.velocity = velocity; + Rigidbody.velocity = velocity; } private void OnCollisionEnter2D(Collision2D other) { ProjectilePool.Instance.Return(this); + audioSource.Play(); if (other.transform.CompareTag("Player")) other.gameObject.GetComponent().Die(); @@ -41,7 +44,7 @@ namespace AI private void UpdateRigidbody() { - _rigidbody.simulated = !IsPaused; + Rigidbody.simulated = !IsPaused; } } } diff --git a/Assets/Scripts/AI/ProjectilePool.cs b/Assets/Scripts/AI/ProjectilePool.cs index 500fc7b..35b95e1 100644 --- a/Assets/Scripts/AI/ProjectilePool.cs +++ b/Assets/Scripts/AI/ProjectilePool.cs @@ -42,14 +42,16 @@ namespace AI if (projectile == null) projectile = Instantiate(prefab).GetComponent(); - projectile.gameObject.SetActive(true); + projectile.transform.position = Vector3.left * 10000; + projectile.Rigidbody.simulated = true; return projectile; } public void Return(Projectile projectile) { - projectile.gameObject.SetActive(false); + projectile.Rigidbody.simulated = false; + projectile.transform.position = Vector3.right * 10000; pool.Push(projectile); } }