audio for game over + succing little blobs
This commit is contained in:
@@ -23,8 +23,10 @@ public class DamageHandler : MonoBehaviour
|
||||
public AudioSource speaker;
|
||||
public AudioClip fallsound;
|
||||
|
||||
public AudioClip splashSound;
|
||||
|
||||
private void Awake()
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
rb = GetComponent<Rigidbody2D>();
|
||||
animator = GetComponent<Animator>();
|
||||
@@ -101,7 +103,8 @@ public class DamageHandler : MonoBehaviour
|
||||
if (other.CompareTag("Minidrop"))
|
||||
{
|
||||
UpdateHealth(health + 0.2f);
|
||||
Destroy(other.gameObject);
|
||||
AudioSource.PlayClipAtPoint(splashSound, Camera.main.transform.position);
|
||||
Destroy(other.gameObject);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ public class GameOverScript : MonoBehaviour
|
||||
[SerializeField]
|
||||
private float duration = 2.0f;
|
||||
|
||||
[SerializeField]
|
||||
private AudioSource audioSource;
|
||||
|
||||
void Start()
|
||||
{
|
||||
image.SetActive(false);
|
||||
@@ -23,6 +26,10 @@ public class GameOverScript : MonoBehaviour
|
||||
elapsed += Time.deltaTime;
|
||||
if(elapsed >= duration) {
|
||||
image.SetActive(true);
|
||||
if (audioSource != null)
|
||||
{
|
||||
audioSource.Play();
|
||||
}
|
||||
if (Input.anyKeyDown)
|
||||
{
|
||||
SceneManager.LoadScene(0, LoadSceneMode.Single);
|
||||
|
||||
Reference in New Issue
Block a user