From 3b5f818eca79d703ab2d3f86ba262822d27b4b7f Mon Sep 17 00:00:00 2001 From: angelws <13520097@std.stei.itb.ac.id> Date: Sun, 16 Apr 2023 10:41:55 +0700 Subject: [PATCH] audio --- Assets/Audio/Enemy.meta | 8 + Assets/Audio/Enemy/elementalawake.wav | 3 + Assets/Audio/Enemy/elementalawake.wav.meta | 22 ++ Assets/Audio/Enemy/elementaldeath.wav | 3 + Assets/Audio/Enemy/elementaldeath.wav.meta | 22 ++ Assets/Audio/Enemy/elementalhurt2.wav | 3 + Assets/Audio/Enemy/elementalhurt2.wav.meta | 22 ++ Assets/Audio/Enemy/punching.wav | 3 + Assets/Audio/Enemy/punching.wav.meta | 22 ++ Assets/Audio/Enemy/winter.wav | 3 + Assets/Audio/Enemy/winter.wav.meta | 22 ++ .../Prefabs/IceElemental Variant.prefab | 295 +++++++++++++++++- Assets/Scripts/Boss/ElementalAttack.cs | 3 +- Assets/Scripts/Boss/ElementalHealth.cs | 12 +- Assets/Scripts/Boss/Punch.cs | 1 + Assets/Scripts/Managers/GameControl.cs | 16 + 16 files changed, 452 insertions(+), 8 deletions(-) create mode 100644 Assets/Audio/Enemy.meta create mode 100644 Assets/Audio/Enemy/elementalawake.wav create mode 100644 Assets/Audio/Enemy/elementalawake.wav.meta create mode 100644 Assets/Audio/Enemy/elementaldeath.wav create mode 100644 Assets/Audio/Enemy/elementaldeath.wav.meta create mode 100644 Assets/Audio/Enemy/elementalhurt2.wav create mode 100644 Assets/Audio/Enemy/elementalhurt2.wav.meta create mode 100644 Assets/Audio/Enemy/punching.wav create mode 100644 Assets/Audio/Enemy/punching.wav.meta create mode 100644 Assets/Audio/Enemy/winter.wav create mode 100644 Assets/Audio/Enemy/winter.wav.meta diff --git a/Assets/Audio/Enemy.meta b/Assets/Audio/Enemy.meta new file mode 100644 index 0000000..4e83189 --- /dev/null +++ b/Assets/Audio/Enemy.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 67e744dc1aed2864c8f4cc0990ed1993 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Audio/Enemy/elementalawake.wav b/Assets/Audio/Enemy/elementalawake.wav new file mode 100644 index 0000000..ef3a1c5 --- /dev/null +++ b/Assets/Audio/Enemy/elementalawake.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1950d91454b9f9c4cb917c632c4916a69c764bddc183196f5f9dffadd103f39d +size 690664 diff --git a/Assets/Audio/Enemy/elementalawake.wav.meta b/Assets/Audio/Enemy/elementalawake.wav.meta new file mode 100644 index 0000000..e88b274 --- /dev/null +++ b/Assets/Audio/Enemy/elementalawake.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 774c1492d14e66049bb6d91964f92fa8 +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/Audio/Enemy/elementaldeath.wav b/Assets/Audio/Enemy/elementaldeath.wav new file mode 100644 index 0000000..6227989 --- /dev/null +++ b/Assets/Audio/Enemy/elementaldeath.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bbb6ccdc2f8e892d33ae98e7db3a8f986027ea222e48c4c122423e8d0d09fb3 +size 518042 diff --git a/Assets/Audio/Enemy/elementaldeath.wav.meta b/Assets/Audio/Enemy/elementaldeath.wav.meta new file mode 100644 index 0000000..5e7e225 --- /dev/null +++ b/Assets/Audio/Enemy/elementaldeath.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 7ca492971357e3d4f88ad1ae1cdc942d +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/Audio/Enemy/elementalhurt2.wav b/Assets/Audio/Enemy/elementalhurt2.wav new file mode 100644 index 0000000..84aeab9 --- /dev/null +++ b/Assets/Audio/Enemy/elementalhurt2.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d136efb0770b75608854cf519a0c454d74bfc944be35416b93ad510f3e080e1 +size 171774 diff --git a/Assets/Audio/Enemy/elementalhurt2.wav.meta b/Assets/Audio/Enemy/elementalhurt2.wav.meta new file mode 100644 index 0000000..2de4e80 --- /dev/null +++ b/Assets/Audio/Enemy/elementalhurt2.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 0a877564e519e2844b3dae8f20c2f751 +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/Audio/Enemy/punching.wav b/Assets/Audio/Enemy/punching.wav new file mode 100644 index 0000000..e293127 --- /dev/null +++ b/Assets/Audio/Enemy/punching.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62cf38522c52289c2cf81e141918c04d6d272e4775215b48e63ed90d7ca0d479 +size 152578 diff --git a/Assets/Audio/Enemy/punching.wav.meta b/Assets/Audio/Enemy/punching.wav.meta new file mode 100644 index 0000000..e64c6bf --- /dev/null +++ b/Assets/Audio/Enemy/punching.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: ba1da75f974412848884ff9a12ff1fd4 +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/Audio/Enemy/winter.wav b/Assets/Audio/Enemy/winter.wav new file mode 100644 index 0000000..a00105a --- /dev/null +++ b/Assets/Audio/Enemy/winter.wav @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb8208589463bddae2dfbd9670c62ab516fb6c89606ddcc66be551ae289c13f9 +size 3317316 diff --git a/Assets/Audio/Enemy/winter.wav.meta b/Assets/Audio/Enemy/winter.wav.meta new file mode 100644 index 0000000..8638d02 --- /dev/null +++ b/Assets/Audio/Enemy/winter.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 21a0f3738c3bde749b8d09a6767eba6e +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/Scenes/Prefabs/IceElemental Variant.prefab b/Assets/Scenes/Prefabs/IceElemental Variant.prefab index 3269b9a..a6a6692 100644 --- a/Assets/Scenes/Prefabs/IceElemental Variant.prefab +++ b/Assets/Scenes/Prefabs/IceElemental Variant.prefab @@ -10674,7 +10674,7 @@ MonoBehaviour: currentHealth: 0 sinkSpeed: 2.5 scoreValue: 20 - deathClip: {fileID: 0} + deathClip: {fileID: 8300000, guid: 7ca492971357e3d4f88ad1ae1cdc942d, type: 3} enemyType: 3 --- !u!114 &1342252998 MonoBehaviour: @@ -10723,6 +10723,102 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ec0e32a23344d4445915259352cc0143, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!82 &7004690727590047864 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1760742258666222088} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 0a877564e519e2844b3dae8f20c2f751, 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 --- !u!1 &1981026317368482649 stripped GameObject: m_CorrespondingSourceObject: {fileID: 9144888486752774905, guid: 96e44255d011f5c4a961e18f28e7cb82, type: 3} @@ -10783,3 +10879,200 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5467c05bdf61876469c4a4df8dee7c4c, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &3577769854080307199 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6066882965869788767, guid: 96e44255d011f5c4a961e18f28e7cb82, type: 3} + m_PrefabInstance: {fileID: 7320371740260413856} + m_PrefabAsset: {fileID: 0} +--- !u!82 &6036070675586069530 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3577769854080307199} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 774c1492d14e66049bb6d91964f92fa8, type: 3} + m_PlayOnAwake: 1 + 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 +--- !u!82 &3483497054415972717 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3577769854080307199} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 21a0f3738c3bde749b8d09a6767eba6e, type: 3} + m_PlayOnAwake: 1 + m_Volume: 0.802 + m_Pitch: 1 + Loop: 1 + 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/Boss/ElementalAttack.cs b/Assets/Scripts/Boss/ElementalAttack.cs index 0a2c5f9..348480e 100644 --- a/Assets/Scripts/Boss/ElementalAttack.cs +++ b/Assets/Scripts/Boss/ElementalAttack.cs @@ -2,6 +2,7 @@ using UnityEngine; using System.Collections; using System.Collections.Generic; + public class ElementalAttack : MonoBehaviour { public float timeBetweenAttacks = 5f; @@ -70,7 +71,7 @@ public class ElementalAttack : MonoBehaviour return; } playerMovement.speed -= 3f; - // Debug.Log("Slower " + playerMovement.speed); + StartCoroutine(DissapearFrostBite(timeFreezeEffect)); playerHealth.TakeFreeze(timeFreezeEffect); } diff --git a/Assets/Scripts/Boss/ElementalHealth.cs b/Assets/Scripts/Boss/ElementalHealth.cs index 9701e42..cf62656 100644 --- a/Assets/Scripts/Boss/ElementalHealth.cs +++ b/Assets/Scripts/Boss/ElementalHealth.cs @@ -10,7 +10,7 @@ public class ElementalHealth : MonoBehaviour, IEnemyHealthHandler public EnemyType enemyType; Animator anim; - // AudioSource enemyAudio; + AudioSource enemyAudio; ParticleSystem hitParticles; CapsuleCollider capsuleCollider; bool isDeath; @@ -21,7 +21,7 @@ public class ElementalHealth : MonoBehaviour, IEnemyHealthHandler { anim = GetComponent<Animator>(); - // enemyAudio = GetComponent <AudioSource> (); + enemyAudio = GetComponent<AudioSource>(); hitParticles = GameObject.Find("ElementalHit").GetComponent<ParticleSystem>(); capsuleCollider = GetComponent<CapsuleCollider>(); @@ -40,7 +40,7 @@ public class ElementalHealth : MonoBehaviour, IEnemyHealthHandler currentHealth = 0; } - // enemyAudio.Play (); + enemyAudio.Play(); currentHealth -= amount; @@ -65,14 +65,14 @@ public class ElementalHealth : MonoBehaviour, IEnemyHealthHandler anim.SetBool("IsHurt", isDeath); - // enemyAudio.clip = deathClip; - // enemyAudio.Play (); + enemyAudio.clip = deathClip; + enemyAudio.Play(); questTemple.OnDeathEnemy(enemyType); GetComponent<UnityEngine.AI.NavMeshAgent>().enabled = false; GetComponent<Rigidbody>().isKinematic = true; GameControl.control.currency += 50; ScoreManager.score += scoreValue; - Destroy(gameObject, 2f); + StartCoroutine(GameControl.control.StartFade(enemyAudio, 2f, 0f, gameObject)); } } diff --git a/Assets/Scripts/Boss/Punch.cs b/Assets/Scripts/Boss/Punch.cs index 9a8156a..b6b3442 100644 --- a/Assets/Scripts/Boss/Punch.cs +++ b/Assets/Scripts/Boss/Punch.cs @@ -17,6 +17,7 @@ public class Punch : MonoBehaviour if (other.gameObject.tag == "Player") { attack.Attack(20); + attack.Slower(); } } } \ No newline at end of file diff --git a/Assets/Scripts/Managers/GameControl.cs b/Assets/Scripts/Managers/GameControl.cs index 620745a..fd2622b 100644 --- a/Assets/Scripts/Managers/GameControl.cs +++ b/Assets/Scripts/Managers/GameControl.cs @@ -73,4 +73,20 @@ public class GameControl : MonoBehaviour { currency -= amt; } + + // From: https://johnleonardfrench.com/how-to-fade-audio-in-unity-i-tested-every-method-this-ones-the-best + public IEnumerator StartFade(AudioSource audioSource, float duration, float targetVolume, GameObject theGameObject) + { + float currentTime = 0; + float start = audioSource.volume; + while (currentTime < duration) + { + currentTime += Time.deltaTime; + audioSource.volume = Mathf.Lerp(start, targetVolume, currentTime / duration); + yield return null; + } + Destroy(theGameObject, 2f); + yield break; + + } } -- GitLab