using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MusicController : MonoBehaviour {

    private static MusicController instance = null;
    private AudioSource aSource;

    public void Awake()
    {
        if (instance == null)
            instance = this;
        else if (instance != this)
            Destroy(gameObject);

        DontDestroyOnLoad(gameObject);

        aSource = GetComponent<AudioSource>();

        StartMusic();
    }

    public void LateUpdate()
    {
        transform.position = Camera.main.transform.position;
    }

    public void StartMusic()
    {
        aSource.Play();
    }
}
