diff --git a/Assets/Scripts/Earthquake.cs b/Assets/Scripts/Earthquake.cs index b07acc3..6bc1ebb 100644 --- a/Assets/Scripts/Earthquake.cs +++ b/Assets/Scripts/Earthquake.cs @@ -1,7 +1,7 @@ -using System; -using UnityEngine; -using System.Collections; - +using System; +using UnityEngine; +using System.Collections; + public class Earthquake : MonoBehaviour { public float CriticalMin; @@ -14,18 +14,18 @@ public class Earthquake : MonoBehaviour { private SpriteRenderer core; PlanetManager pmgr; - bool isExploding; - - - // Use this for initialization + bool isExploding; + + + // Use this for initialization public void Start() { isExploding = false; pmgr = FindObjectOfType(); - core = this.GetComponent(); - } - - // Update is called once per frame + core = this.GetComponent(); + } + + // Update is called once per frame public void Update () { if(isExploding) return; @@ -41,7 +41,7 @@ public class Earthquake : MonoBehaviour { if (val2 >= CriticalMax + 0.05f) { EarthquakeBoom(); - } + } } void OnGUI() @@ -57,13 +57,19 @@ public class Earthquake : MonoBehaviour { { isExploding = true; StartCoroutine(Explode()); - Instantiate(ExplosionParticle); - var camera = GameObject.Find("Main Camera"); - if (camera) - { - var shaker = camera.GetComponent(); - if (shaker) shaker.shakeTimeAmount = 2.0f; - } + Instantiate(ExplosionParticle); + + var audioBoom = gameObject.GetComponent(); + audioBoom.bypassListenerEffects = true; + AudioSource.PlayClipAtPoint(audioBoom.clip, transform.position, audioBoom.volume); + + + var camera = GameObject.Find("Main Camera"); + if (camera) + { + var shaker = camera.GetComponent(); + if (shaker) shaker.shakeTimeAmount = 2.0f; + } } IEnumerator Explode() @@ -76,5 +82,5 @@ public class Earthquake : MonoBehaviour { pmgr.EjectPlayers(realPosition); yield return null; } - } -} + } +} diff --git a/Assets/Sounds/A_SFX_Planet_Explosion_01.wav b/Assets/Sounds/A_SFX_Planet_Explosion_01.wav new file mode 100644 index 0000000..2f33a16 Binary files /dev/null and b/Assets/Sounds/A_SFX_Planet_Explosion_01.wav differ diff --git a/Assets/Sounds/A_SFX_Planet_Explosion_01.wav.meta b/Assets/Sounds/A_SFX_Planet_Explosion_01.wav.meta new file mode 100644 index 0000000..ff7388c --- /dev/null +++ b/Assets/Sounds/A_SFX_Planet_Explosion_01.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: d1c2b1851e3fc7147bf24267eabf01fd +timeCreated: 1460236386 +licenseType: Pro +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: