Re-think singleton player idea, add raycasting to stop from falling off ledges

This commit is contained in:
2022-08-15 15:40:04 -07:00
parent 4a4add3668
commit 9a245d94c7
23 changed files with 661 additions and 439 deletions

View File

@@ -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()