Re-think singleton player idea, add raycasting to stop from falling off ledges
This commit is contained in:
@@ -7,18 +7,27 @@ namespace Scampz.GameJam.Assets.Scripts
|
||||
{
|
||||
public class BGMManager : MonoBehaviour
|
||||
{
|
||||
public static BGMManager Instance { get; private set; }
|
||||
|
||||
[SerializeField]
|
||||
private AudioSource audioSource;
|
||||
|
||||
[SerializeField]
|
||||
private AudioClip[] backgroundMusic;
|
||||
|
||||
private void Awake()
|
||||
private static BGMManager _instance;
|
||||
|
||||
public static BGMManager Instance
|
||||
{
|
||||
if (Instance == null)
|
||||
Instance = this;
|
||||
get
|
||||
{
|
||||
if (!_instance)
|
||||
{
|
||||
_instance = new GameObject().AddComponent<BGMManager>();
|
||||
_instance.name = _instance.GetType().ToString();
|
||||
DontDestroyOnLoad(_instance.gameObject);
|
||||
}
|
||||
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySong()
|
||||
|
||||
Reference in New Issue
Block a user