This commit is contained in:
Beau Vink 2025-11-04 21:39:02 +01:00
commit 6b1040cad3
12 changed files with 129 additions and 295 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://cjyr1b0fxfofx"]
[gd_scene load_steps=6 format=3 uid="uid://cjyr1b0fxfofx"]
[ext_resource type="Texture2D" uid="uid://cplpndk6qv7sx" path="res://assets/photo-images/Case_Button.png" id="1_3vy0q"]
[ext_resource type="Texture2D" uid="uid://2cn7xvs6k1r5" path="res://assets/photo-images/Case_file.png" id="2_vi7i2"]
@ -21,29 +21,7 @@ func _on_input_event(viewport: Node, event: InputEvent, _shape_idx: int) -> void
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vo7lu"]
size = Vector2(52.031464, 209.99301)
[sub_resource type="TextMesh" id="TextMesh_mes51"]
flip_faces = true
text = "Case"
depth = 0.0
[sub_resource type="Gradient" id="Gradient_vo7lu"]
offsets = PackedFloat32Array(1)
colors = PackedColorArray(0, 0, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_wjago"]
gradient = SubResource("Gradient_vo7lu")
[node name="CaseFile" type="FilePopup"]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
[node name="MeshInstance2D2" type="MeshInstance2D" parent="."]
position = Vector2(29.999994, 581.83563)
@ -68,11 +46,4 @@ position = Vector2(-0.17065811, 0.93725586)
scale = Vector2(1.0000002, 1.0000002)
shape = SubResource("RectangleShape2D_vo7lu")
[node name="MeshInstance2D3" type="MeshInstance2D" parent="."]
position = Vector2(30.888136, 582.9807)
rotation = 1.5707964
scale = Vector2(-347.0554, 307.87436)
mesh = SubResource("TextMesh_mes51")
texture = SubResource("GradientTexture1D_wjago")
[connection signal="input_event" from="Area2D" to="Area2D" method="_on_input_event"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://qmb60kjx6yoe"]
[gd_scene load_steps=6 format=3 uid="uid://qmb60kjx6yoe"]
[ext_resource type="Texture2D" uid="uid://bwu83rfxi4mmh" path="res://assets/photo-images/Victim_Button.png" id="1_ajbhq"]
[ext_resource type="Texture2D" uid="uid://ckj2guah0egq0" path="res://assets/photo-images/Victim_file.png" id="2_ajbhq"]
@ -21,29 +21,7 @@ func _on_input_event(viewport: Node, event: InputEvent, _shape_idx: int) -> void
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vo7lu"]
size = Vector2(52.031464, 209.99301)
[sub_resource type="TextMesh" id="TextMesh_7cefc"]
flip_faces = true
text = "Victim"
depth = 0.0
[sub_resource type="Gradient" id="Gradient_vo7lu"]
offsets = PackedFloat32Array(1)
colors = PackedColorArray(0, 0, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_wjago"]
gradient = SubResource("Gradient_vo7lu")
[node name="VictimFile" type="FilePopup"]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
[node name="MeshInstance2D2" type="MeshInstance2D" parent="."]
position = Vector2(27, 143.99998)
@ -67,11 +45,4 @@ script = SubResource("GDScript_7cefc")
scale = Vector2(1.0000002, 1.0000002)
shape = SubResource("RectangleShape2D_vo7lu")
[node name="MeshInstance2D3" type="MeshInstance2D" parent="."]
position = Vector2(33.037315, 137.30455)
rotation = 1.5707964
scale = Vector2(-347.0554, 307.87436)
mesh = SubResource("TextMesh_7cefc")
texture = SubResource("GradientTexture1D_wjago")
[connection signal="input_event" from="Area2D" to="Area2D" method="_on_input_event"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://drcl138k0gym0"]
[gd_scene load_steps=6 format=3 uid="uid://drcl138k0gym0"]
[ext_resource type="Texture2D" uid="uid://dravu5852jgek" path="res://assets/photo-images/Witness_Button.png" id="1_a8epn"]
[ext_resource type="Texture2D" uid="uid://b17g56nxrdbti" path="res://assets/photo-images/Witness_file.png" id="2_a8epn"]
@ -19,31 +19,9 @@ func _on_input_event(viewport: Node, event: InputEvent, _shape_idx: int) -> void
"
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vo7lu"]
size = Vector2(52.031464, 209.99301)
[sub_resource type="TextMesh" id="TextMesh_vo7lu"]
flip_faces = true
text = "Witness"
depth = 0.0
[sub_resource type="Gradient" id="Gradient_vo7lu"]
offsets = PackedFloat32Array(1)
colors = PackedColorArray(0, 0, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_wjago"]
gradient = SubResource("Gradient_vo7lu")
size = Vector2(78.999985, 208.99994)
[node name="WitnessReport" type="FilePopup"]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
[node name="MeshInstance2D2" type="MeshInstance2D" parent="."]
position = Vector2(23.000008, 372.50003)
@ -64,14 +42,8 @@ position = Vector2(28.265099, 374.51465)
script = SubResource("GDScript_7cefc")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(-2.7650986, -1.0146484)
scale = Vector2(1.0000002, 1.0000002)
shape = SubResource("RectangleShape2D_vo7lu")
[node name="MeshInstance2D3" type="MeshInstance2D" parent="."]
position = Vector2(30.982576, 372.43265)
rotation = 1.5707964
scale = Vector2(-347.0554, 307.87436)
mesh = SubResource("TextMesh_vo7lu")
texture = SubResource("GradientTexture1D_wjago")
[connection signal="input_event" from="Area2D" to="Area2D" method="_on_input_event"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=3 uid="uid://o3ri154wpbrx"]
[gd_scene load_steps=19 format=3 uid="uid://o3ri154wpbrx"]
[ext_resource type="PackedScene" uid="uid://btcmnw6q6g0h0" path="res://objects/pinned_photo.tscn" id="1_7cefc"]
[ext_resource type="PackedScene" uid="uid://kk4ecpjc4puc" path="res://scenes/results_ui.tscn" id="1_thvsl"]
@ -27,13 +27,31 @@ func notify_conclusion_sent(method : int, motive : int, murderer : int) -> void:
[sub_resource type="QuadMesh" id="QuadMesh_usqe2"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_87mh6"]
size = Vector2(965, 601)
size = Vector2(764, 450)
[sub_resource type="QuadMesh" id="QuadMesh_cnvne"]
[sub_resource type="CircleShape2D" id="CircleShape2D_cnvne"]
radius = 7.280088
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_h7pmq"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
bg_color = Color(0.3254902, 0.34901962, 0.75686276, 1)
skew = Vector2(0.105, 0)
border_width_left = 5
border_width_top = 5
border_width_right = 5
border_width_bottom = 5
border_color = Color(0.011764706, 0.011764706, 0.015686275, 1)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
corner_detail = 5
[sub_resource type="GDScript" id="GDScript_cnvne"]
script/source = "extends Button
@ -46,6 +64,7 @@ func _pressed() -> void:
else:
print(\"Conclusion: \", %WeaponSlot.get_current_clue(), \", \", %MotiveSlot.get_current_clue(), \", \", %MurdererSlot.get_current_clue())
owner.notify_conclusion_sent(%WeaponSlot.get_current_clue(), %MotiveSlot.get_current_clue(), %MurdererSlot.get_current_clue())
func update_can_send():
self.disabled = not (%WeaponSlot.is_filled() and %MotiveSlot.is_filled() and %MurdererSlot.is_filled())
@ -53,18 +72,6 @@ func _on_any_slot_selection_changed(_new_value: int) -> void:
update_can_send()
"
[sub_resource type="TextMesh" id="TextMesh_cnvne"]
flip_faces = true
text = "Method, Motive, Murderer"
depth = 0.0
[sub_resource type="Gradient" id="Gradient_thvsl"]
offsets = PackedFloat32Array(0)
colors = PackedColorArray(0, 0, 0, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_c1nar"]
gradient = SubResource("Gradient_thvsl")
[node name="Workspace" type="Node2D"]
script = SubResource("GDScript_thvsl")
conclusion_screen = ExtResource("1_thvsl")
@ -73,22 +80,12 @@ conclusion_screen = ExtResource("1_thvsl")
anchor_mode = 0
[node name="Pinboard" type="Pinboard" parent="."]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
position = Vector2(109, 19)
script = null
[node name="MeshInstance2D" type="MeshInstance2D" parent="Pinboard"]
position = Vector2(794.49994, 417)
position = Vector2(859.21375, 523.26025)
rotation = 3.1415927
scale = Vector2(1535.0001, 818)
scale = Vector2(1950.2444, 1090.4237)
mesh = SubResource("QuadMesh_usqe2")
texture = ExtResource("2_c1nar")
@ -98,7 +95,7 @@ scale = Vector2(0.8171887, 0.8931035)
texture = ExtResource("3_ffegw")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Pinboard"]
position = Vector2(636.5, 431.5)
position = Vector2(661, 429)
shape = SubResource("RectangleShape2D_87mh6")
[node name="UntitledArtwork" type="Sprite2D" parent="Pinboard"]
@ -106,11 +103,13 @@ position = Vector2(1391, 172)
texture = ExtResource("4_r41gl")
[node name="EnvelopeBack" type="Sprite2D" parent="Pinboard"]
position = Vector2(1533, 852)
position = Vector2(1612.9009, 898.8248)
scale = Vector2(0.7405022, 0.7405022)
texture = ExtResource("4_h7pmq")
[node name="EnvelopeFront" type="Sprite2D" parent="Pinboard"]
position = Vector2(1534, 855)
position = Vector2(1613.9009, 901.8248)
scale = Vector2(0.7405022, 0.7405022)
texture = ExtResource("5_r41gl")
[node name="Handin" type="Node2D" parent="."]
@ -123,60 +122,25 @@ scale = Vector2(553.986, -740.514)
mesh = SubResource("QuadMesh_cnvne")
texture = ExtResource("6_xic1t")
[node name="TextEdit" type="TextEdit" parent="Handin"]
offset_left = -508.21082
offset_top = 553.0962
offset_right = -24.305176
offset_bottom = 714.85803
backspace_deletes_composite_character_enabled = true
wrap_mode = 1
[node name="WeaponSlot" type="ConclusionField" parent="Handin"]
_import_path = NodePath("")
unique_name_in_owner = true
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
position = Vector2(-448.5945, 290.4132)
script = null
position = Vector2(-139.3271, 528.6141)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Handin/WeaponSlot"]
position = Vector2(0, 43.237)
shape = SubResource("CircleShape2D_cnvne")
[node name="MotiveSlot" type="ConclusionField" parent="Handin"]
_import_path = NodePath("")
unique_name_in_owner = true
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
position = Vector2(-268.54337, 292.97845)
script = null
position = Vector2(-135.66975, 322.58594)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Handin/MotiveSlot"]
position = Vector2(0, 43.237)
shape = SubResource("CircleShape2D_cnvne")
[node name="MurdererSlot" type="ConclusionField" parent="Handin"]
_import_path = NodePath("")
unique_name_in_owner = true
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
position = Vector2(-99.188446, 288.08786)
script = null
position = Vector2(-399.06177, 88.315475)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Handin/MurdererSlot"]
position = Vector2(0, 43.237)
@ -184,162 +148,75 @@ shape = SubResource("CircleShape2D_cnvne")
[node name="SubmitButton" type="Button" parent="Handin"]
unique_name_in_owner = true
offset_left = -307.37988
offset_top = 502.53214
offset_right = -230.37988
offset_bottom = 533.5321
offset_left = -500.62653
offset_top = 718.6055
offset_right = -389.62653
offset_bottom = 768.6055
theme_override_colors/font_color = Color(0.84705883, 0.10980392, 0.56078434, 1)
theme_override_font_sizes/font_size = 30
theme_override_styles/normal = SubResource("StyleBoxFlat_h7pmq")
text = "Submit"
script = SubResource("GDScript_cnvne")
[node name="MeshInstance2D2" type="MeshInstance2D" parent="Handin"]
position = Vector2(-273.59598, 222.70421)
rotation = 3.1415927
scale = Vector2(-236.09602, 249.81453)
mesh = SubResource("TextMesh_cnvne")
texture = SubResource("GradientTexture1D_c1nar")
[node name="PhotosParent" type="Node2D" parent="."]
[node name="PhotoInbox" type="PhotoInbox" parent="PhotosParent"]
position = Vector2(1727, 830)
photo_scene = ExtResource("1_7cefc")
[node name="PinnedPhoto" parent="PhotosParent" instance=ExtResource("1_7cefc")]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
position = Vector2(441, 822)
clue = 12
[node name="PinnedPhoto2" parent="PhotosParent" instance=ExtResource("1_7cefc")]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
position = Vector2(647, 825)
clue = 13
[node name="PinnedPhoto3" parent="PhotosParent" instance=ExtResource("1_7cefc")]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
position = Vector2(833, 823)
clue = 14
[node name="PinnedPhoto4" parent="PhotosParent" instance=ExtResource("1_7cefc")]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
position = Vector2(1019, 825)
clue = 15
[node name="PinnedPhoto5" parent="PhotosParent" instance=ExtResource("1_7cefc")]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
position = Vector2(534, 911)
clue = 16
[node name="PinnedPhoto6" parent="PhotosParent" instance=ExtResource("1_7cefc")]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
position = Vector2(709, 912)
clue = 17
[node name="PinnedPhoto7" parent="PhotosParent" instance=ExtResource("1_7cefc")]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
position = Vector2(881, 910)
clue = 18
[node name="PinnedPhoto8" parent="PhotosParent" instance=ExtResource("1_7cefc")]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
position = Vector2(1053, 912)
clue = 19
[node name="PinnedPhoto9" parent="PhotosParent" instance=ExtResource("1_7cefc")]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
position = Vector2(1227, 911)
clue = 20
[node name="PinnedPhoto10" parent="PhotosParent" instance=ExtResource("1_7cefc")]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
script = null
position = Vector2(775, 381)
clue = 11
[node name="PhotoInbox" type="PhotoInbox" parent="PhotosParent"]
_import_path = NodePath("")
unique_name_in_owner = false
process_mode = 0
process_priority = 0
process_physics_priority = 0
process_thread_group = 0
physics_interpolation_mode = 0
auto_translate_mode = 0
editor_description = ""
position = Vector2(1717, 889)
photo_scene = ExtResource("1_7cefc")
script = null
[node name="VictimFile" parent="." node_paths=PackedStringArray("open_position") instance=ExtResource("2_vo7lu")]
open_position = NodePath("../FilePositionTarget")
[node name="VictimFile" parent="." instance=ExtResource("2_vo7lu")]
[node name="WitnessReport" parent="." node_paths=PackedStringArray("open_position") instance=ExtResource("3_wjago")]
open_position = NodePath("../FilePositionTarget")
[node name="WitnessReport" parent="." instance=ExtResource("3_wjago")]
[node name="CaseFile" parent="." instance=ExtResource("4_cnvne")]
[node name="CaseFile" parent="." node_paths=PackedStringArray("open_position") instance=ExtResource("4_cnvne")]
open_position = NodePath("../FilePositionTarget")
[node name="FilePositionTarget" type="Node2D" parent="."]
position = Vector2(678.00006, 63.999996)
rotation = -0.0034519732
[connection signal="selection_changed" from="Handin/WeaponSlot" to="Handin/SubmitButton" method="_on_any_slot_selection_changed"]
[connection signal="selection_changed" from="Handin/MotiveSlot" to="Handin/SubmitButton" method="_on_any_slot_selection_changed"]
[connection signal="selection_changed" from="Handin/MurdererSlot" to="Handin/SubmitButton" method="_on_any_slot_selection_changed"]

View file

@ -7,11 +7,16 @@
ClientNode *ClientNode::singleton_instance{ nullptr };
String const ClientNode::sig_connection_changed{ "connection_changed" };
String const ClientNode::sig_conclusion_received{ "conclusion_received" };
void ClientNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("connect_to_server", "server_url"), &self_type::connect_to_server);
ADD_SIGNAL(MethodInfo(sig_connection_changed, PropertyInfo(Variant::INT, "connected", PROPERTY_HINT_ENUM, "Disconnected,Connected,Authenticated")));
ADD_SIGNAL(MethodInfo(sig_conclusion_received,
PropertyInfo(Variant::INT, "method", PROPERTY_HINT_ENUM, NetworkData::ClueID_hint()),
PropertyInfo(Variant::INT, "motive", PROPERTY_HINT_ENUM, NetworkData::ClueID_hint()),
PropertyInfo(Variant::INT, "murderer", PROPERTY_HINT_ENUM, NetworkData::ClueID_hint())));
}
void ClientNode::enter_tree() {
@ -32,6 +37,11 @@ void ClientNode::process() {
reveal_backlog();
}
}
bool const new_has_conclusion{ ydi::client::receive::has_conclusion() };
if (new_has_conclusion != this->conclusion.is_full()) {
this->conclusion = ydi::client::receive::conclusion();
emit_signal(sig_conclusion_received, this->conclusion[0], this->conclusion[1], this->conclusion[2]);
}
}
void ClientNode::exit_tree() {

View file

@ -1,5 +1,6 @@
#pragma once
#include "core/templates/fixed_vector.h"
#include "scene/main/node.h"
#include "you_done_it/ydi_networking.h"
@ -20,8 +21,10 @@ public:
void connect_to_server(String const &url);
private:
FixedVector<NetworkData::ClueID, 3> conclusion;
NetworkData::ConnectionStatus state{ NetworkData::CONNECTION_DISCONNECTED };
public:
static String const sig_connection_changed;
static String const sig_conclusion_received;
};

View file

@ -26,7 +26,7 @@ void ClueData::reveal() {
abort();
}
if (this->revealed) {
print_error("Attempt to reveal clue that's already revealed, returning without action");
print_error(vformat("Attempt to reveal clue '%d' that's already revealed, returning without action", this->id));
return;
}
this->revealed = true;

View file

@ -1,5 +1,6 @@
#include "clue_finder.h"
#include "core/config/engine.h"
#include "core/math/math_defs.h"
#include "scene/3d/xr/xr_nodes.h"
#include "scene/main/node.h"
@ -59,12 +60,15 @@ ClueFinder *ClueFinder::get_singleton() {
}
ClueMarker *ClueFinder::find_current_clue() {
float best_score{ Math::INF };
ClueMarker *best_marker{ nullptr };
for (ClueMarker *marker : this->clue_markers) {
if (marker->is_visible()) {
return marker;
if (marker->score_in_view() < best_score) {
print_line("found marker ", marker->get_path());
best_marker = marker;
}
}
return nullptr;
return best_marker;
}
void ClueFinder::register_clue_marker(ClueMarker *marker) {
@ -82,6 +86,7 @@ void ClueFinder::take_photo() {
void ClueFinder::send_photo() {
if (this->found_marker) {
this->found_marker->reveal();
this->found_marker = nullptr;
}
}

View file

@ -31,7 +31,7 @@ void ClueMarker::_notification(int what) {
}
}
bool ClueMarker::is_visible() const {
float ClueMarker::score_in_view() const {
Transform3D const viewpoint{ ClueFinder::get_singleton()->get_global_transform() };
Basis const basis{ viewpoint.get_basis() };
Vector3 const pos_relative{ get_global_position() - viewpoint.get_origin() };
@ -40,7 +40,11 @@ bool ClueMarker::is_visible() const {
return false;
}
Vector3 const transformed_dir{ pos_transformed.normalized() };
return Math::abs(transformed_dir.x) < 0.5 || Math::abs(transformed_dir.y) < 0.5;
float max{ pos_transformed.z / 5.f };
if (Math::abs(transformed_dir.x) < max && Math::abs(transformed_dir.y) < max) {
return Math::INF;
}
return pos_transformed.z * (Math::abs(transformed_dir.x) + Math::abs(transformed_dir.y));
}
void ClueMarker::reveal() {

View file

@ -14,7 +14,7 @@ protected:
void _notification(int what);
public:
bool is_visible() const;
float score_in_view() const;
void reveal();
void set_clue_id(NetworkData::ClueID id);
NetworkData::ClueID get_clue_id() const;

View file

@ -146,6 +146,25 @@ NetworkData::ConnectionStatus status() {
}
}
namespace receive {
FixedVector<NetworkData::ClueID, 3> &conclusion() {
static FixedVector<NetworkData::ClueID, 3> threadsafe_copy{};
if (connection) {
threadsafe_copy = connection->conclusion;
} else {
threadsafe_copy.clear();
}
return threadsafe_copy;
}
bool has_conclusion() {
if (!connection) {
return false;
}
std::scoped_lock lock{ connection->mtx };
return connection->conclusion.is_full();
}
} //namespace receive
namespace send {
void reveal_clue(NetworkData::ClueID id) {
if (connection) {

View file

@ -1,6 +1,7 @@
#pragma once
#include "core/string/ustring.h"
#include "core/templates/fixed_vector.h"
#include "you_done_it/ydi_networking.h"
namespace ydi::client {
@ -8,8 +9,9 @@ void connect(String const &url);
void disconnect();
NetworkData::ConnectionStatus status();
namespace receive {
Vector<NetworkData::ClueID> &conclusion();
}
FixedVector<NetworkData::ClueID, 3> &conclusion();
bool has_conclusion();
} //namespace receive
namespace send {
void reveal_clue(NetworkData::ClueID id);
} //namespace send