18 lines
330 B
C#
18 lines
330 B
C#
using Godot;
|
|
|
|
public partial class BGMPlayer : AudioStreamPlayer
|
|
{
|
|
public void SetBGMFromFilepath(string path)
|
|
{
|
|
var audioStream = ResourceLoader.Load<AudioStream>(path);
|
|
if (Stream != audioStream)
|
|
Stream = audioStream;
|
|
}
|
|
|
|
public void PlayBGM()
|
|
{
|
|
if (!Playing)
|
|
Play();
|
|
}
|
|
}
|