51 lines
863 B
C#
51 lines
863 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class Music : MonoBehaviour
|
|
{
|
|
public static Music Instance { get; set; }
|
|
|
|
public AudioSource music;
|
|
|
|
private void Awake()
|
|
{
|
|
|
|
if (Instance == null)
|
|
{
|
|
Instance = this;
|
|
|
|
DontDestroyOnLoad(this);
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void MuteSound()
|
|
{
|
|
if (music.mute == false)
|
|
{
|
|
music.mute = true;
|
|
}
|
|
else
|
|
{
|
|
music.mute = false;
|
|
}
|
|
}
|
|
}
|