feat: added clue delete and send sounds

This commit is contained in:
Sara Gerretsen 2025-11-06 00:33:50 +01:00
parent 794aa73960
commit b7f9f99057
24 changed files with 68 additions and 9 deletions

View file

@ -1,7 +1,6 @@
#include "clue_finder.h"
#include "core/config/engine.h"
#include "core/math/math_defs.h"
#include "scene/3d/mesh_instance_3d.h"
#include "scene/3d/xr/xr_nodes.h"
#include "scene/main/node.h"
#include "scene/resources/material.h"
@ -10,10 +9,14 @@
ClueFinder *ClueFinder::singleton_instance{ nullptr };
String const ClueFinder::sig_found_marker_changed{ "found_marker_changed" };
String const ClueFinder::sig_clue_deleted{ "clue_deleted" };
String const ClueFinder::sig_clue_sent{ "clue_sent" };
void ClueFinder::_bind_methods() {
ClassDB::bind_method(D_METHOD("take_photo"), &ClueFinder::take_photo);
ADD_SIGNAL(MethodInfo(sig_found_marker_changed, PropertyInfo(Variant::BOOL, "has_marker")));
ADD_SIGNAL(MethodInfo(sig_clue_deleted));
ADD_SIGNAL(MethodInfo(sig_clue_sent));
BIND_HPROPERTY(Variant::OBJECT, empty_texture, PROPERTY_HINT_RESOURCE_TYPE, "Texture");
BIND_HPROPERTY(Variant::OBJECT, photo_material, PROPERTY_HINT_RESOURCE_TYPE, "StandardMaterial3D");
}
@ -105,6 +108,7 @@ void ClueFinder::send_photo() {
this->found_marker->reveal();
this->found_marker = nullptr;
emit_signal(sig_found_marker_changed, false);
emit_signal(sig_clue_sent);
photo_material->set_texture(BaseMaterial3D::TEXTURE_ALBEDO, this->empty_texture);
}
}
@ -113,6 +117,7 @@ void ClueFinder::delete_photo() {
if (this->found_marker) {
this->found_marker = nullptr;
emit_signal(sig_found_marker_changed, false);
emit_signal(sig_clue_deleted);
photo_material->set_texture(BaseMaterial3D::TEXTURE_ALBEDO, this->empty_texture);
}
}

View file

@ -38,4 +38,6 @@ private:
public:
static String const sig_found_marker_changed;
static String const sig_clue_deleted;
static String const sig_clue_sent;
};