BGJ-2022.1/Assets/Scripts/Player/Death.cs

20 lines
503 B
C#
Raw Normal View History

2022-02-26 18:31:19 +03:00
using Level;
using UnityEngine;
namespace Player
{
public class Death : MonoBehaviour
{
private AudioSource audioSource = null;
private void Start() => audioSource = GetComponent<AudioSource>();
public void Die()
{
LevelManager.Instance.CurrentLevel.Restart();
// Playing it after the restart because when the player gets deactivated the sound stops so it doesn't play the sound at all
audioSource.Play();
}
}
}