diff --git a/IF3210-2024-Unity-AFK/Assets/Audio/Sound/background_horror.mp3 b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/background_horror.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..fb90c7d3cb266acdd848f982b075e15f19fa3d9a --- /dev/null +++ b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/background_horror.mp3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c129a21521f2e0212b847cb880547f28d96d30af8d2aa8b19387ba326fff603c +size 2498560 diff --git a/IF3210-2024-Unity-AFK/Assets/Audio/Sound/background_horror.mp3.meta b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/background_horror.mp3.meta new file mode 100644 index 0000000000000000000000000000000000000000..ce53d2bcfa6132a07d25f433d6f9cced62d5ac54 --- /dev/null +++ b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/background_horror.mp3.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: ea2d51c544565a141b2077540e1b5697 +AudioImporter: + externalObjects: {} + serializedVersion: 7 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + preloadAudioData: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/IF3210-2024-Unity-AFK/Assets/Audio/Sound/possessed_laugh.mp3 b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/possessed_laugh.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..499ae2871e0c85ce397571528ed6282ae09dcfdc --- /dev/null +++ b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/possessed_laugh.mp3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb196fcd5b4be7e393cd7b8c321030fbc30792528059928c56861506491ad4e6 +size 97440 diff --git a/IF3210-2024-Unity-AFK/Assets/Audio/Sound/possessed_laugh.mp3.meta b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/possessed_laugh.mp3.meta new file mode 100644 index 0000000000000000000000000000000000000000..0f7abe4229c39cd6fc4c3f316b415338f89b1f1f --- /dev/null +++ b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/possessed_laugh.mp3.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 6e56d32c9c87b7e43827cc1e6019cebd +AudioImporter: + externalObjects: {} + serializedVersion: 7 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + preloadAudioData: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/IF3210-2024-Unity-AFK/Assets/Audio/Sound/screech.mp3 b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/screech.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..e0d93db1448e2a9526231c06aa919f66b5dbb61f --- /dev/null +++ b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/screech.mp3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:41cb0611a603a6c2db5ba6fe985f237febc0a1e257783456edb3f6cffd7ed0e5 +size 302400 diff --git a/IF3210-2024-Unity-AFK/Assets/Audio/Sound/screech.mp3.meta b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/screech.mp3.meta new file mode 100644 index 0000000000000000000000000000000000000000..7f8a54ab971ec7a881079ffba557e32ab97fda5c --- /dev/null +++ b/IF3210-2024-Unity-AFK/Assets/Audio/Sound/screech.mp3.meta @@ -0,0 +1,23 @@ +fileFormatVersion: 2 +guid: 7d0f696c9bca0d844b9cbf0f4227ad01 +AudioImporter: + externalObjects: {} + serializedVersion: 7 + defaultSettings: + serializedVersion: 2 + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + preloadAudioData: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Gun/GunSystem.cs b/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Gun/GunSystem.cs index 1e41dd70aa92359b6a7b725eb5806015b57a60f7..efc31fc81f36bf41fb5a4bc57d442cf01a897a6d 100644 --- a/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Gun/GunSystem.cs +++ b/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Gun/GunSystem.cs @@ -80,8 +80,10 @@ public class GunSystem : BaseWeaponController Shoot(); } - if (bulletsLeft <= 0 && shooting && !reloading) ; + if (bulletsLeft <= 0 && shooting && !reloading) + { PlayOutOfAmmo(); + } } private void PlayOutOfAmmo() diff --git a/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Mobs/KingBehaviour.cs b/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Mobs/KingBehaviour.cs index a16b56c34be2f6a565554bb68be368880669cea8..2aa70c6d6d267c51ebbd18f37c848256c8e7bb98 100644 --- a/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Mobs/KingBehaviour.cs +++ b/IF3210-2024-Unity-AFK/Assets/Code/Scripts/Mobs/KingBehaviour.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; +using UnityEngine.UIElements; public class KingBehaviour : MonoBehaviour { @@ -38,6 +39,10 @@ public class KingBehaviour : MonoBehaviour public GunSystemMobs gunSystem; + public AudioClip backgroundMusic; + public AudioClip screechAudio; + public AudioClip laughAudio; + private bool audioChange = true; // Start is called before the first frame update void Start() @@ -51,6 +56,9 @@ public class KingBehaviour : MonoBehaviour kingAnimator.SetBool(attackAnimation, true); movementController = GetComponent<CharacterController>(); StartCoroutine(SpawnKeroco()); + + StartCoroutine(PlayBackgroundAudio()); + StartCoroutine(PlayMobAudio()); } // Update is called once per frame @@ -234,6 +242,31 @@ public class KingBehaviour : MonoBehaviour } } + IEnumerator PlayMobAudio() + { + while (true) + { + if (audioChange) + { + AudioManagerScript.Instance.PlaySFX(screechAudio); + } else + { + AudioManagerScript.Instance.PlaySFX(laughAudio); + } + audioChange = !audioChange; + yield return new WaitForSeconds(30.0f); + } + } + + IEnumerator PlayBackgroundAudio() + { + while (true) + { + AudioManagerScript.Instance.PlaySFX(backgroundMusic); + yield return new WaitForSeconds(85.0f); + } + } + private void OnDestroy() { enemyController.GetComponent<OrbController>().DropOrb(this.transform);