diff --git a/export_presets.cfg b/export_presets.cfg
index 7a58afc..30c3c11 100644
--- a/export_presets.cfg
+++ b/export_presets.cfg
@@ -9,7 +9,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
-export_path="_builds/Babushka_win_0_5/Babushka.exe"
+export_path="_builds/Babushka_showcase_6a/Babushka.exe"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
@@ -26,6 +26,7 @@ debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
+shader_baker/enabled=false
binary_format/architecture="x86_64"
codesign/enable=false
codesign/timestamp=true
@@ -79,7 +80,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
-export_path="_builds/Babushka_linux_0_5/Babushka.x86_64"
+export_path="_builds/Babushka_showcase_lux_06a/Babushka.x86_64"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
@@ -96,6 +97,7 @@ debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
+shader_baker/enabled=false
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
diff --git a/prefabs/interactions/detection_cross.tscn b/prefabs/interactions/detection_cross.tscn
index 5814bea..3e0695a 100644
--- a/prefabs/interactions/detection_cross.tscn
+++ b/prefabs/interactions/detection_cross.tscn
@@ -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")]
diff --git a/prefabs/interactions/detector.tscn b/prefabs/interactions/detector.tscn
index 967829b..74721b6 100644
--- a/prefabs/interactions/detector.tscn
+++ b/prefabs/interactions/detector.tscn
@@ -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)
diff --git a/prefabs/interactions/interaction_area_2d.tscn b/prefabs/interactions/interaction_area_2d.tscn
index fb04b7f..73bbc94 100644
--- a/prefabs/interactions/interaction_area_2d.tscn
+++ b/prefabs/interactions/interaction_area_2d.tscn
@@ -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")
diff --git a/project.godot b/project.godot
index 66ef019..362fd84 100644
--- a/project.godot
+++ b/project.godot
@@ -176,6 +176,7 @@ directories/tres_directory={
"unselected_stylebox": "res://addons/dialogic/Editor/Events/styles/unselected_stylebox.tres",
"var_ColorTestValue": "res://resources/low code/test/var_ColorTestValue.tres",
"var_Counter": "res://resources/low code/test/var_Counter.tres",
+"var_interactableToTrigger": "res://resources/low code/interactables/var_interactableToTrigger.tres",
"var_sceneNameProvider": "res://resources/low code/farming/var_sceneNameProvider.tres",
"var_wateredFieldPosition": "res://resources/low code/farming/var_wateredFieldPosition.tres",
"vesna_style": "res://addons/dialogic/vesna_style.tres",
diff --git a/resources/low code/interactables/var_interactableToTrigger.tres b/resources/low code/interactables/var_interactableToTrigger.tres
new file mode 100644
index 0000000..f2242f8
--- /dev/null
+++ b/resources/low code/interactables/var_interactableToTrigger.tres
@@ -0,0 +1,8 @@
+[gd_resource type="Resource" script_class="VariableResource" load_steps=2 format=3 uid="uid://clwqh3w5aqi5e"]
+
+[ext_resource type="Script" uid="uid://dtvx2cakx0bey" path="res://scripts/CSharp/Low Code/Variables/VariableResource.cs" id="1_casar"]
+
+[resource]
+script = ExtResource("1_casar")
+Payload = null
+metadata/_custom_type_script = "uid://dtvx2cakx0bey"
diff --git a/scripts/CSharp/Common/CharacterControls/DetectableInteractionArea.cs b/scripts/CSharp/Common/CharacterControls/DetectableInteractionArea.cs
index 2d67333..e630f62 100644
--- a/scripts/CSharp/Common/CharacterControls/DetectableInteractionArea.cs
+++ b/scripts/CSharp/Common/CharacterControls/DetectableInteractionArea.cs
@@ -7,4 +7,16 @@ namespace Babushka.scripts.CSharp.Common.CharacterControls;
///
public partial class DetectableInteractionArea : Area2D
{
+ [Export] public InteractionArea2D interactionArea2D;
+
+ public void Detected()
+ {
+ GD.Print("Detected " + interactionArea2D.GetParent().Name);
+ interactionArea2D.IsSelectedByDetector = true;
+ }
+
+ public void NoLongerDetected()
+ {
+ interactionArea2D.IsSelectedByDetector = false;
+ }
}
\ No newline at end of file
diff --git a/scripts/CSharp/Common/CharacterControls/DetectionCross.cs b/scripts/CSharp/Common/CharacterControls/DetectionCross.cs
index 1ce4e12..00b3223 100644
--- a/scripts/CSharp/Common/CharacterControls/DetectionCross.cs
+++ b/scripts/CSharp/Common/CharacterControls/DetectionCross.cs
@@ -7,7 +7,8 @@ namespace Babushka.scripts.CSharp.Common.CharacterControls;
///
public partial class DetectionCross : Node2D
{
- [Export] private Detector _detector;
+ [Export] private Detector _collider;
+ [Export] private RaycastDetector _detector;
[Export] private float _xOffset;
[Export] private float _yOffset;
@@ -17,6 +18,8 @@ public partial class DetectionCross : Node2D
///
public void SetDirection(Vector2 direction)
{
- _detector.Position = new Vector2(direction.X * _xOffset, direction.Y * _yOffset);
+ Vector2 newPos = new Vector2(direction.X * _xOffset, direction.Y * _yOffset);
+ _collider.GlobalPosition = newPos;
+ _detector.TargetPosition = newPos;
}
}
\ No newline at end of file
diff --git a/scripts/CSharp/Common/CharacterControls/Detector.cs b/scripts/CSharp/Common/CharacterControls/Detector.cs
index 95767d0..3aba858 100644
--- a/scripts/CSharp/Common/CharacterControls/Detector.cs
+++ b/scripts/CSharp/Common/CharacterControls/Detector.cs
@@ -1,5 +1,6 @@
using Babushka.scripts.CSharp.Common.Services;
using Godot;
+using Godot.Collections;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
@@ -10,7 +11,7 @@ public partial class Detector : Area2D
{
[Export] private bool _active = true;
-
+
///
/// Called when entering an interactionArea node.
///
@@ -41,7 +42,7 @@ public partial class Detector : Area2D
/// Called every time this node enters an Area2D.
///
///
- public void OnEnteredInteractable(Node area)
+ public void OnEnteredInteractable(Area2D area)
{
if (!_active || !InputService.Instance.InputEnabled)
return;
@@ -56,13 +57,14 @@ public partial class Detector : Area2D
/// Called whenever this node exits an Area2D.
///
///
- public void OnExitedInteractable(Node area)
+ public void OnExitedInteractable(Area2D area)
{
if (!_active || !InputService.Instance.InputEnabled)
return;
if (area is DetectableInteractionArea interactionArea2D)
{
+
EmitSignal(SignalName.InteractableExited);
}
}
diff --git a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs
index 0b84dbd..e7601d1 100644
--- a/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs
+++ b/scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs
@@ -1,5 +1,6 @@
using System.Linq;
using Babushka.scripts.CSharp.Common.Services;
+using Babushka.scripts.CSharp.Low_Code.Variables;
using Godot;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
@@ -28,6 +29,8 @@ public partial class InteractionArea2D : Node2D
set => _active = value;
}
+ public bool IsSelectedByDetector { get; set; } = false;
+
public void SetActiveInverse(bool active)
{
IsActive = !active;
@@ -52,6 +55,9 @@ public partial class InteractionArea2D : Node2D
if (!_useOutline)
return;
+ if (!IsSelectedByDetector)
+ return;
+
foreach (var sprite in _spritesToOutline)
{
sprite.Material = _outlineMaterial;
@@ -76,6 +82,9 @@ public partial class InteractionArea2D : Node2D
{
if (!_active || !InputService.Instance.InputEnabled)
return;
+
+ if(!IsSelectedByDetector)
+ return;
if (@event.IsAction("interact") && @event.IsPressed())
{
diff --git a/scripts/CSharp/Common/CharacterControls/RaycastDetector.cs b/scripts/CSharp/Common/CharacterControls/RaycastDetector.cs
new file mode 100644
index 0000000..88b54ff
--- /dev/null
+++ b/scripts/CSharp/Common/CharacterControls/RaycastDetector.cs
@@ -0,0 +1,40 @@
+using Godot;
+
+namespace Babushka.scripts.CSharp.Common.CharacterControls;
+
+public partial class RaycastDetector : RayCast2D
+{
+ [Export] private bool _active = true;
+
+ private DetectableInteractionArea? _lastDetected;
+
+ public bool IsActive
+ {
+ get => _active;
+ set
+ {
+ Visible = value;
+ _active = value;
+ }
+ }
+
+ public override void _PhysicsProcess(double delta)
+ {
+ if (!_active)
+ return;
+
+ if (IsColliding())
+ {
+ if (GetCollider() is DetectableInteractionArea interactionArea)
+ {
+ if (_lastDetected != null && _lastDetected != interactionArea)
+ {
+ _lastDetected.NoLongerDetected();
+ }
+
+ _lastDetected = interactionArea;
+ interactionArea.Detected();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/scripts/CSharp/Common/CharacterControls/RaycastDetector.cs.uid b/scripts/CSharp/Common/CharacterControls/RaycastDetector.cs.uid
new file mode 100644
index 0000000..6b83bca
--- /dev/null
+++ b/scripts/CSharp/Common/CharacterControls/RaycastDetector.cs.uid
@@ -0,0 +1 @@
+uid://b4n0nlu4ckqga