🚧 WIP detection works now

This commit is contained in:
2025-12-12 13:46:32 +01:00
parent 7ffbb8e68d
commit 9e0e87ef17
13 changed files with 105 additions and 99 deletions
+10 -9
View File
@@ -2,19 +2,20 @@
[ext_resource type="Script" uid="uid://ccc6m6c5khd2x" path="res://scripts/CSharp/Common/CharacterControls/DetectionCross.cs" id="1_va8tx"]
[ext_resource type="PackedScene" uid="uid://dugr6ff1g7hi0" path="res://prefabs/interactions/detector.tscn" id="2_8hh05"]
[ext_resource type="Script" uid="uid://b4n0nlu4ckqga" path="res://scripts/CSharp/Common/CharacterControls/RaycastDetector.cs" id="2_va8tx"]
[node name="DetectionCross" type="Node2D" node_paths=PackedStringArray("_collider", "_detector")]
position = Vector2(0, 1)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_va8tx"]
[node name="DetectionCross" type="Node2D" node_paths=PackedStringArray("_collider", "_shapeCast2D")]
script = ExtResource("1_va8tx")
_collider = NodePath("detector")
_detector = NodePath("Raycast")
_shapeCast2D = NodePath("ShapeCast2D")
_xOffset = 200.0
_yOffset = 200.0
[node name="Raycast" type="RayCast2D" parent="."]
target_position = Vector2(222, -168)
collide_with_areas = true
script = ExtResource("2_va8tx")
[node name="detector" parent="." node_paths=PackedStringArray("_shapeCast2D") instance=ExtResource("2_8hh05")]
_shapeCast2D = NodePath("../ShapeCast2D")
[node name="detector" parent="." instance=ExtResource("2_8hh05")]
[node name="ShapeCast2D" type="ShapeCast2D" parent="."]
shape = SubResource("RectangleShape2D_va8tx")
target_position = Vector2(200, 0)
collide_with_areas = true
+4 -2
View File
@@ -1,13 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://dugr6ff1g7hi0"]
[gd_scene load_steps=4 format=3 uid="uid://dugr6ff1g7hi0"]
[ext_resource type="Script" uid="uid://c3pd60biootsx" path="res://scripts/CSharp/Common/CharacterControls/Detector.cs" id="1_6pib0"]
[ext_resource type="Resource" uid="uid://clwqh3w5aqi5e" path="res://resources/low code/interactables/var_interactableToTrigger.tres" id="2_3fanv"]
[sub_resource type="CircleShape2D" id="CircleShape2D_6pib0"]
radius = 200.0
radius = 300.0
[node name="detector" type="Area2D"]
collision_layer = 4
script = ExtResource("1_6pib0")
_itemToTriggerResource = ExtResource("2_3fanv")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_6pib0")
@@ -1,9 +1,10 @@
[gd_scene load_steps=7 format=3 uid="uid://cqc72e4hq6bcd"]
[gd_scene load_steps=8 format=3 uid="uid://cqc72e4hq6bcd"]
[ext_resource type="Script" uid="uid://ckp413wrub5fm" path="res://scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs" id="1_5ajrf"]
[ext_resource type="Resource" uid="uid://clwqh3w5aqi5e" path="res://resources/low code/interactables/var_interactableToTrigger.tres" id="2_o1drf"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/simple_interactable_outline.tres" id="2_qoey7"]
[ext_resource type="Script" uid="uid://cp2q4k62sjo6h" path="res://scripts/CSharp/Common/CharacterControls/DetectableInteractionArea.cs" id="3_2wrrq"]
[ext_resource type="Script" uid="uid://pqemey80frcq" path="res://scripts/CSharp/Low Code/Variables/VariableListener.cs" id="4_gj2nu"]
[sub_resource type="CircleShape2D" id="CircleShape2D_npluf"]
resource_local_to_scene = true
@@ -14,7 +15,6 @@ default_font_size = 30
[node name="InteractionArea" type="Node2D" node_paths=PackedStringArray("_area", "_label")]
script = ExtResource("1_5ajrf")
_interactableToTrigger = ExtResource("2_o1drf")
_area = NodePath("Area2D")
_label = NodePath("Area2D/CanvasLayer/MarginContainer/Label")
_outlineMaterial = ExtResource("2_qoey7")
@@ -54,5 +54,8 @@ text = "[E]"
horizontal_alignment = 2
vertical_alignment = 2
[connection signal="area_entered" from="Area2D" to="." method="OnPlayerEntered"]
[connection signal="area_exited" from="Area2D" to="." method="OnPlayerExited"]
[node name="SelectionListener" type="Node" parent="."]
script = ExtResource("4_gj2nu")
_variableResources = Array[Object]([ExtResource("2_o1drf")])
[connection signal="NewEventPayload" from="SelectionListener" to="Area2D" method="InteractionAreaSelectionChanged"]