#include "sound_event_patchboard.h" SoundEventPatchboard *SoundEventPatchboard::singleton_instance{ nullptr }; String const SoundEventPatchboard::sig_sound_triggered{ "sound_triggered" }; void SoundEventPatchboard::_bind_methods() { ClassDB::bind_method(D_METHOD("trigger_sound", "at", "range"), &self_type::trigger_sound); ADD_SIGNAL(MethodInfo(sig_sound_triggered, PropertyInfo(Variant::VECTOR3, "at"), PropertyInfo(Variant::FLOAT, "range"))); } SoundEventPatchboard::SoundEventPatchboard() { singleton_instance = this; } SoundEventPatchboard::~SoundEventPatchboard() { if (singleton_instance == this) { singleton_instance = nullptr; } } SoundEventPatchboard *SoundEventPatchboard::get_singleton() { return singleton_instance; } void SoundEventPatchboard::trigger_sound(Vector3 at, float range) { emit_signal(sig_sound_triggered, at, range); }