using Godot; using System; public partial class CollisionSound : AudioStreamPlayer { Node controller; bool firstPlayed = false; public override void _Ready() { controller = GetNode("/root/ControllerEventBus"); Callable callable = new Callable(this, MethodName.OnControllerContact); controller.Connect("new_target", callable); this.OnControllerContact(this); } public void OnControllerContact(Node node) { if (firstPlayed) this.Play(); firstPlayed = true; } }