rj-action-library/Runtime/Actions/Audio/PlayMusic.cs

36 lines
592 B
C#
Raw Normal View History

2025-07-22 14:08:22 +00:00
using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool][GlobalClass]
public partial class PlayMusic:Action
{
[Export]
public AudioStreamPlayer music;
[Export]
public bool stopSiblingPlayers = false;
protected override void _OnTrigger()
{
if ( stopSiblingPlayers )
{
GetParent().ForEachDirectChild<AudioStreamPlayer>(
( p )=>
{
if ( p == music )
{
return;
}
p.Stop();
}
);
}
music.Play();
}
}
}