From faf59d6815ca0925e943ddb9bbaa25e1a69d8dd7 Mon Sep 17 00:00:00 2001 From: Ali Sharoz Date: Wed, 27 Nov 2024 17:01:20 +0500 Subject: [PATCH] Sounds Addition --- .../3rd/D2D_Scripts/Gameplay/Health/Health.cs | 5 +- Assets/ButtonSoundClick.cs | 29 +++ Assets/ButtonSoundClick.cs.meta | 11 + Assets/Prefabs/ButtonSoundClick.prefab | 145 +++++++++++++ Assets/Prefabs/ButtonSoundClick.prefab.meta | 7 + Assets/Scenes/Gameplay.unity | 195 ++++++++++++++++++ Assets/Scenes/MainMenu.unity | 58 ++++++ Assets/Sounds/ButtonClick.wav | Bin 0 -> 88930 bytes Assets/Sounds/ButtonClick.wav.meta | 23 +++ Assets/Sounds/EnemyDeath.mp3 | Bin 0 -> 7357 bytes Assets/Sounds/EnemyDeath.mp3.meta | 23 +++ .../UI/Increase Fire Rate Button_1.prefab | 4 +- .../Source/Prefabs/UI/Upgrade Button.prefab | 8 +- Assets/Source/Scripts/EnemySpawn.cs | 1 + 14 files changed, 502 insertions(+), 7 deletions(-) create mode 100644 Assets/ButtonSoundClick.cs create mode 100644 Assets/ButtonSoundClick.cs.meta create mode 100644 Assets/Prefabs/ButtonSoundClick.prefab create mode 100644 Assets/Prefabs/ButtonSoundClick.prefab.meta create mode 100644 Assets/Sounds/ButtonClick.wav create mode 100644 Assets/Sounds/ButtonClick.wav.meta create mode 100644 Assets/Sounds/EnemyDeath.mp3 create mode 100644 Assets/Sounds/EnemyDeath.mp3.meta diff --git a/Assets/3rd/D2D_Scripts/Gameplay/Health/Health.cs b/Assets/3rd/D2D_Scripts/Gameplay/Health/Health.cs index 744deab6..95e7b975 100644 --- a/Assets/3rd/D2D_Scripts/Gameplay/Health/Health.cs +++ b/Assets/3rd/D2D_Scripts/Gameplay/Health/Health.cs @@ -166,7 +166,10 @@ namespace D2D.Gameplay private void InitiateDeathSequence() { Died?.Invoke(); - + if(!_isPlayer) + { + _enemySpawn.EnemyDeathAudio.Play(); + } if (_isGrayFadeout) { GrayFadeoutDeath(); diff --git a/Assets/ButtonSoundClick.cs b/Assets/ButtonSoundClick.cs new file mode 100644 index 00000000..1bdfa92f --- /dev/null +++ b/Assets/ButtonSoundClick.cs @@ -0,0 +1,29 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class ButtonSoundClick : MonoBehaviour +{ + public AudioSource audioSource; + public Button[] allButtons; + private void Start() + { + Starter(); + } + void Starter() + { + allButtons = FindObjectsOfType