Exemple #1
0
    private void Awake()
    {
        if (S != null)
        {
            DestroyImmediate(gameObject);
            return;
        }

        S = this;

        currentBgm = previousBgm = BgmSoundCode.None;



        Camera mainCamera = Camera.main;

        bgmSpeaker = mainCamera.GetComponent <AudioSource>();
        if (bgmSpeaker == null)
        {
            bgmSpeaker = mainCamera.gameObject.AddComponent <AudioSource>();
        }
        bgmSpeaker.loop = true;


        EventManager.StartListening(typeof(SoundEvent), SoundListener);
    }
Exemple #2
0
    // Start is called before the first frame update

    void Awake()
    {
        if (CsSoundManager.instance == null)
        {
            CsSoundManager.instance = this;
        }
    }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }