CultivateImmortal/Assets/Scripts/SoundManager.cs
2024-11-14 18:15:51 +08:00

27 lines
473 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SoundManager : MonoBehaviour
{
[SerializeField]
private AudioSource audioSource;
[SerializeField]
private AudioClip bg;
void Start()
{
audioSource=GetComponent<AudioSource>();
}
public void playBg()
{
audioSource.clip = bg;
audioSource.Play();
}
public void stopBg()
{
audioSource.Stop();
}
}