mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-25 19:10:58 +00:00
Exploding sound planet
This commit is contained in:
parent
ad03730dbb
commit
48bf509abe
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
public class Earthquake : MonoBehaviour {
|
public class Earthquake : MonoBehaviour {
|
||||||
|
|
||||||
public float CriticalMin;
|
public float CriticalMin;
|
||||||
@ -14,18 +14,18 @@ public class Earthquake : MonoBehaviour {
|
|||||||
private SpriteRenderer core;
|
private SpriteRenderer core;
|
||||||
PlanetManager pmgr;
|
PlanetManager pmgr;
|
||||||
|
|
||||||
bool isExploding;
|
bool isExploding;
|
||||||
|
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
isExploding = false;
|
isExploding = false;
|
||||||
pmgr = FindObjectOfType<PlanetManager>();
|
pmgr = FindObjectOfType<PlanetManager>();
|
||||||
core = this.GetComponent<SpriteRenderer>();
|
core = this.GetComponent<SpriteRenderer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
public void Update () {
|
public void Update () {
|
||||||
|
|
||||||
if(isExploding) return;
|
if(isExploding) return;
|
||||||
@ -41,7 +41,7 @@ public class Earthquake : MonoBehaviour {
|
|||||||
if (val2 >= CriticalMax + 0.05f)
|
if (val2 >= CriticalMax + 0.05f)
|
||||||
{
|
{
|
||||||
EarthquakeBoom();
|
EarthquakeBoom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnGUI()
|
void OnGUI()
|
||||||
@ -57,13 +57,19 @@ public class Earthquake : MonoBehaviour {
|
|||||||
{
|
{
|
||||||
isExploding = true;
|
isExploding = true;
|
||||||
StartCoroutine(Explode());
|
StartCoroutine(Explode());
|
||||||
Instantiate(ExplosionParticle);
|
Instantiate(ExplosionParticle);
|
||||||
var camera = GameObject.Find("Main Camera");
|
|
||||||
if (camera)
|
var audioBoom = gameObject.GetComponent<AudioSource>();
|
||||||
{
|
audioBoom.bypassListenerEffects = true;
|
||||||
var shaker = camera.GetComponent<CameraShake>();
|
AudioSource.PlayClipAtPoint(audioBoom.clip, transform.position, audioBoom.volume);
|
||||||
if (shaker) shaker.shakeTimeAmount = 2.0f;
|
|
||||||
}
|
|
||||||
|
var camera = GameObject.Find("Main Camera");
|
||||||
|
if (camera)
|
||||||
|
{
|
||||||
|
var shaker = camera.GetComponent<CameraShake>();
|
||||||
|
if (shaker) shaker.shakeTimeAmount = 2.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator Explode()
|
IEnumerator Explode()
|
||||||
@ -76,5 +82,5 @@ public class Earthquake : MonoBehaviour {
|
|||||||
pmgr.EjectPlayers(realPosition);
|
pmgr.EjectPlayers(realPosition);
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Assets/Sounds/A_SFX_Planet_Explosion_01.wav
Normal file
BIN
Assets/Sounds/A_SFX_Planet_Explosion_01.wav
Normal file
Binary file not shown.
22
Assets/Sounds/A_SFX_Planet_Explosion_01.wav.meta
Normal file
22
Assets/Sounds/A_SFX_Planet_Explosion_01.wav.meta
Normal file
@ -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:
|
||||||
Loading…
x
Reference in New Issue
Block a user