🚧 interaction kinda sorta works now, still needs tweaking
This commit is contained in:
@@ -2123,9 +2123,6 @@ frame = 7
|
||||
frame_progress = 0.229832
|
||||
offset = Vector2(0, -450)
|
||||
|
||||
[node name="DetectionCross" parent="CharacterBody2D" instance=ExtResource("466_e04c3")]
|
||||
position = Vector2(0, -200)
|
||||
|
||||
[node name="PlantCreatedEventListener" type="Node" parent="CharacterBody2D"]
|
||||
script = ExtResource("467_8hbu5")
|
||||
_eventResources = Array[Object]([ExtResource("468_t1d6r")])
|
||||
@@ -2175,6 +2172,9 @@ scrollable = false
|
||||
script = ExtResource("472_kduih")
|
||||
_wateringCanFillStateNode = NodePath("../WateringCanFillState")
|
||||
|
||||
[node name="DetectionCross" parent="CharacterBody2D" instance=ExtResource("466_e04c3")]
|
||||
position = Vector2(0, -371)
|
||||
|
||||
[node name="FarmingControls" type="Node2D" parent="." node_paths=PackedStringArray("_movingPlayer")]
|
||||
script = ExtResource("817_6nrw3")
|
||||
_sceneKeyProvider = ExtResource("471_83c4i")
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
[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)
|
||||
script = ExtResource("1_va8tx")
|
||||
_collider = NodePath("detector")
|
||||
_detector = NodePath("Raycast")
|
||||
@@ -12,8 +13,7 @@ _xOffset = 200.0
|
||||
_yOffset = 200.0
|
||||
|
||||
[node name="Raycast" type="RayCast2D" parent="."]
|
||||
top_level = true
|
||||
target_position = Vector2(257, -149)
|
||||
target_position = Vector2(222, -168)
|
||||
collide_with_areas = true
|
||||
script = ExtResource("2_va8tx")
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public partial class DetectionCross : Node2D
|
||||
public void SetDirection(Vector2 direction)
|
||||
{
|
||||
Vector2 newPos = new Vector2(direction.X * _xOffset, direction.Y * _yOffset);
|
||||
_collider.GlobalPosition = newPos;
|
||||
_collider.Position = newPos;
|
||||
_detector.TargetPosition = newPos;
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ public partial class InteractionArea2D : Node2D
|
||||
|
||||
public void OnPlayerEntered(Node2D player)
|
||||
{
|
||||
GD.Print("OnPlayerEntered: " + this.GetParent().Name);
|
||||
if (!_active || !InputService.Instance.InputEnabled)
|
||||
return;
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ public partial class RaycastDetector : RayCast2D
|
||||
_lastDetected.NoLongerDetected();
|
||||
}
|
||||
|
||||
GD.Print("Colliding with: " + interactionArea.GetParent().Name);
|
||||
_lastDetected = interactionArea;
|
||||
interactionArea.Detected();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user