🚧 WIP: trying to rework the detection system (it fails)

This commit is contained in:
2025-12-09 17:51:00 +01:00
parent bef54420e4
commit 9499c27444
12 changed files with 106 additions and 17 deletions
+13 -5
View File
@@ -1,12 +1,20 @@
[gd_scene load_steps=3 format=3 uid="uid://pflu0uaig7vv"]
[gd_scene load_steps=4 format=3 uid="uid://pflu0uaig7vv"]
[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("_detector")]
[node name="DetectionCross" type="Node2D" node_paths=PackedStringArray("_collider", "_detector")]
script = ExtResource("1_va8tx")
_detector = NodePath("detector")
_xOffset = 400.0
_yOffset = 300.0
_collider = NodePath("detector")
_detector = NodePath("Raycast")
_xOffset = 200.0
_yOffset = 200.0
[node name="Raycast" type="RayCast2D" parent="."]
top_level = true
target_position = Vector2(257, -149)
collide_with_areas = true
script = ExtResource("2_va8tx")
[node name="detector" parent="." instance=ExtResource("2_8hh05")]
+3 -3
View File
@@ -2,13 +2,13 @@
[ext_resource type="Script" uid="uid://c3pd60biootsx" path="res://scripts/CSharp/Common/CharacterControls/Detector.cs" id="1_6pib0"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qwv4c"]
size = Vector2(100, 400)
[sub_resource type="CircleShape2D" id="CircleShape2D_6pib0"]
radius = 200.0
[node name="detector" type="Area2D"]
collision_layer = 4
script = ExtResource("1_6pib0")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_qwv4c")
shape = SubResource("CircleShape2D_6pib0")
debug_color = Color(0.9459047, 7.2196126e-06, 0.5925879, 0.41960785)
@@ -1,6 +1,7 @@
[gd_scene load_steps=6 format=3 uid="uid://cqc72e4hq6bcd"]
[gd_scene load_steps=7 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"]
@@ -13,13 +14,15 @@ 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")
[node name="Area2D" type="Area2D" parent="."]
[node name="Area2D" type="Area2D" parent="." node_paths=PackedStringArray("interactionArea2D")]
collision_mask = 4
script = ExtResource("3_2wrrq")
interactionArea2D = NodePath("..")
[node name="CollisionShape3D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_npluf")