36 lines
592 B
C#
36 lines
592 B
C#
|
|
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();
|
|
}
|
|
}
|
|
} |