Compare commits

..

5 Commits

20 changed files with 198 additions and 94 deletions
@@ -0,0 +1,9 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://bv3m12duf0dj6"]
[ext_resource type="Shader" uid="uid://dsa3lv2as7q3b" path="res://shader/outline.gdshader" id="1_fxlom"]
[resource]
shader = ExtResource("1_fxlom")
shader_parameter/allow_out_of_bounds = true
shader_parameter/outline_thickness = 8.0
shader_parameter/outline_color = Color(0.88, 0.54208, 0.4576, 1)
@@ -1,9 +1,9 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://blch5kdhkbj75"]
[ext_resource type="Shader" uid="uid://dsa3lv2as7q3b" path="res://shader/outline.gdshader" id="1_awyqf"]
[ext_resource type="Shader" uid="uid://dsa3lv2as7q3b" path="res://shader/outline.gdshader" id="1_ovtva"]
[resource]
shader = ExtResource("1_awyqf")
shader = ExtResource("1_ovtva")
shader_parameter/allow_out_of_bounds = true
shader_parameter/outline_thickness = 8.0
shader_parameter/outline_color = Color(0.88, 0.81664, 0.4576, 1)
shader_parameter/outline_color = Color(0.88, 0.79684, 0.3256, 1)
+1 -3
View File
@@ -1,8 +1,7 @@
[gd_scene load_steps=16 format=3 uid="uid://sbf12hin4kes"]
[gd_scene load_steps=15 format=3 uid="uid://sbf12hin4kes"]
[ext_resource type="Texture2D" uid="uid://bylgmr0skwtrs" path="res://art/farm/farming/farmobjekte/broken tools atlas.png" id="1_k4ca3"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="2_gcgfd"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="3_ic616"]
[ext_resource type="AudioStream" uid="uid://be6g8b3v3u1ai" path="res://audio/sfx/Kitchen/SFX_Cooking_Knife_PickUp_01.wav" id="3_ktmp7"]
[ext_resource type="AudioStream" uid="uid://cgjsajsdrrn0j" path="res://audio/sfx/Kitchen/SFX_Cooking_Knife_PutDown_01.wav" id="4_ic616"]
[ext_resource type="AudioStream" uid="uid://br4drgupled6c" path="res://audio/sfx/Kitchen/SFX_Cooking_Pot_01.wav" id="5_dx175"]
@@ -38,7 +37,6 @@ region_rect = Rect2(44, 479, 356, 503)
[node name="InteractionArea" parent="." node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("2_gcgfd")]
position = Vector2(0, -172)
_outlineMaterial = ExtResource("3_ic616")
_spriteToOutline = NodePath("..")
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
+1 -1
View File
@@ -3,7 +3,7 @@
[ext_resource type="Script" uid="uid://d0kgxh4ykuv23" path="res://scripts/CSharp/Common/NPC/TalkingCharacter.cs" id="1_xix7p"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="2_udjjv"]
[ext_resource type="Texture2D" uid="uid://bgba1uv0muxat" path="res://art/characters/chugeist_tmp.png" id="3_42og6"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="3_kd44q"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/simple_interactable_outline.tres" id="3_kd44q"]
[ext_resource type="Script" uid="uid://d2486x6upmwqq" path="res://scripts/GdScript/dialogic_starter.gd" id="43_xooq4"]
[ext_resource type="Script" uid="uid://cvkw4qd2hxksi" path="res://scripts/GdScript/dialogic_toggle.gd" id="44_v6w16"]
+25 -21
View File
@@ -1,7 +1,8 @@
[gd_scene load_steps=476 format=3 uid="uid://c25udixd5m6l0"]
[gd_scene load_steps=477 format=3 uid="uid://c25udixd5m6l0"]
[ext_resource type="Script" uid="uid://b05uyj001ehwi" path="res://scripts/CSharp/Common/Farming/VesnaBehaviour2D.cs" id="1_yd5ep"]
[ext_resource type="Script" uid="uid://cjbclkxesh3hc" path="res://scripts/CSharp/Common/CharacterControls/Player2D.cs" id="2_1vqmv"]
[ext_resource type="Script" uid="uid://cjbclkxesh3hc" path="res://scripts/CSharp/Common/CharacterControls/PlayerMovement.cs" id="2_1vqmv"]
[ext_resource type="Script" uid="uid://n7oihifvqp23" path="res://scripts/CSharp/Common/Animation/VesnaAnimations.cs" id="3_f6xmn"]
[ext_resource type="Texture2D" uid="uid://7jrac5ii3ah3" path="res://art/animation/Vesna2D/Vesna Anims Sequences/B01-Idle/0001.png" id="3_tb2wl"]
[ext_resource type="Texture2D" uid="uid://c06b551t2qlo6" path="res://art/animation/Vesna2D/Vesna Anims Sequences/B01-Idle/0002.png" id="4_dy5kt"]
[ext_resource type="Texture2D" uid="uid://bj2ssu0ixr0p1" path="res://art/animation/Vesna2D/Vesna Anims Sequences/B01-Idle/0004.png" id="6_3sina"]
@@ -744,7 +745,7 @@ animations = [{
}],
"loop": true,
"name": &"back walking",
"speed": 15.0
"speed": 20.0
}, {
"frames": [{
"duration": 1.0,
@@ -824,7 +825,7 @@ animations = [{
}],
"loop": true,
"name": &"back walking backpack",
"speed": 25.0
"speed": 45.0
}, {
"frames": [{
"duration": 1.0,
@@ -862,7 +863,7 @@ animations = [{
}],
"loop": true,
"name": &"back walking rake",
"speed": 5.0
"speed": 20.0
}, {
"frames": [{
"duration": 1.0,
@@ -900,7 +901,7 @@ animations = [{
}],
"loop": true,
"name": &"back walking wateringcan",
"speed": 15.0
"speed": 20.0
}, {
"frames": [{
"duration": 1.0,
@@ -1471,7 +1472,7 @@ animations = [{
}],
"loop": true,
"name": &"front walking",
"speed": 15.0
"speed": 20.0
}, {
"frames": [{
"duration": 1.0,
@@ -1551,7 +1552,7 @@ animations = [{
}],
"loop": true,
"name": &"front walking backpack",
"speed": 25.0
"speed": 42.0
}, {
"frames": [{
"duration": 1.0,
@@ -1589,7 +1590,7 @@ animations = [{
}],
"loop": true,
"name": &"front walking rake",
"speed": 15.0
"speed": 20.0
}, {
"frames": [{
"duration": 1.0,
@@ -1627,7 +1628,7 @@ animations = [{
}],
"loop": true,
"name": &"front walking wateringcan",
"speed": 15.0
"speed": 20.0
}, {
"frames": [{
"duration": 1.0,
@@ -1948,7 +1949,7 @@ animations = [{
}],
"loop": true,
"name": &"side walking",
"speed": 25.0
"speed": 38.0
}, {
"frames": [{
"duration": 1.0,
@@ -1986,7 +1987,7 @@ animations = [{
}],
"loop": true,
"name": &"side walking rake",
"speed": 15.0
"speed": 16.0
}, {
"frames": [{
"duration": 1.0,
@@ -2024,7 +2025,7 @@ animations = [{
}],
"loop": true,
"name": &"side walking simplified",
"speed": 15.0
"speed": 16.0
}, {
"frames": [{
"duration": 1.0,
@@ -2062,38 +2063,41 @@ animations = [{
}],
"loop": true,
"name": &"side walking wateringcan",
"speed": 11.0
"speed": 16.0
}]
[node name="Vesna" type="Node2D" node_paths=PackedStringArray("_farmingControls", "_player2d")]
[node name="Vesna" type="Node2D" node_paths=PackedStringArray("_farmingControls", "_player2d", "_vesnaAnimations")]
y_sort_enabled = true
script = ExtResource("1_yd5ep")
_farmingControls = NodePath("FarmingControls")
_player2d = NodePath("CharacterBody2D")
_vesnaAnimations = NodePath("CharacterBody2D/visuals/Animated Sprites")
[node name="CharacterBody2D" type="CharacterBody2D" parent="." node_paths=PackedStringArray("_sprite", "_wateringParticles") groups=["PlantGrowing"]]
[node name="CharacterBody2D" type="CharacterBody2D" parent="." groups=["PlantGrowing"]]
position = Vector2(0, 374)
collision_layer = 4
collision_mask = 3
script = ExtResource("2_1vqmv")
_speed = 1500.0
_sprite = NodePath("visuals/Animated Sprites")
_wateringParticles = NodePath("../pouring water vfx")
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
visible = false
z_index = 1
y_sort_enabled = true
position = Vector2(-24, -13)
shape = SubResource("CircleShape2D_ssqtd")
debug_color = Color(0.923708, 0.202722, 0.475262, 0.42)
[node name="visuals" type="Node2D" parent="CharacterBody2D"]
[node name="visuals" type="Node2D" parent="CharacterBody2D" node_paths=PackedStringArray("_sprite", "_wateringParticles")]
position = Vector2(0, -374)
script = ExtResource("3_f6xmn")
_sprite = NodePath("Animated Sprites")
_wateringParticles = NodePath("../../pouring water vfx")
[node name="Animated Sprites" type="AnimatedSprite2D" parent="CharacterBody2D/visuals"]
position = Vector2(0, 450)
sprite_frames = SubResource("SpriteFrames_4yiyq")
animation = &"front walking backpack"
animation = &"side walking wateringcan"
frame_progress = 0.130831
offset = Vector2(0, -450)
[node name="Hoe" type="Sprite2D" parent="CharacterBody2D/visuals"]
+1 -1
View File
@@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="1_tp1yj"]
[ext_resource type="Script" uid="uid://bdffon388rkty" path="res://scripts/CSharp/Common/Farming/FieldBehaviour2D.cs" id="2_c6u1a"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="2_pdgar"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/simple_interactable_outline.tres" id="2_pdgar"]
[ext_resource type="Texture2D" uid="uid://cgmu3qlovdr22" path="res://art/masks/field_outline_1.png" id="3_b5av1"]
[ext_resource type="Texture2D" uid="uid://eg5ej0mtuac" path="res://art/masks/field_outline_2.png" id="4_yav45"]
[ext_resource type="Texture2D" uid="uid://djpigvoyadvjs" path="res://art/masks/field_outline_3.png" id="5_pdgar"]
+1 -1
View File
@@ -16,7 +16,7 @@
[ext_resource type="Animation" uid="uid://b3dwd88uvfk1k" path="res://art/animals/duck_flapFlap.res" id="14_uo3dh"]
[ext_resource type="AudioStream" uid="uid://bsr5m8u2sle5k" path="res://audio/sfx/Animals/SFX_Duck_Wings_07.wav" id="14_xhefb"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="15_uo3dh"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="16_nxoeu"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/simple_interactable_outline.tres" id="16_nxoeu"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_sot7i"]
streams_count = 4
@@ -2,7 +2,7 @@
[ext_resource type="Script" uid="uid://btusf04xnywhm" path="res://scripts/CSharp/Common/Inventory/ItemOnGround2D.cs" id="1_tlhp6"]
[ext_resource type="Script" uid="uid://c8suoi3i6kqai" path="res://scripts/CSharp/Common/Inventory/ItemOnGroundSpawnWith.cs" id="3_xu8me"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="4_harr4"]
[ext_resource type="Material" uid="uid://bv3m12duf0dj6" path="res://art/materials/inventory_interactable_outline.tres" id="4_harr4"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="4_xu8me"]
[ext_resource type="Texture2D" uid="uid://cfxibry711o16" path="res://art/ui/UI/icons/icon-scythe.png" id="5_harr4"]
@@ -17,6 +17,8 @@ resource_local_to_scene = true
radius = 300.0
[node name="GenericItemOnGround" type="Node2D"]
z_index = 1
y_sort_enabled = true
script = ExtResource("1_tlhp6")
[node name="SpawnWithItem" type="Node" parent="."]
@@ -1,7 +1,7 @@
[gd_scene load_steps=5 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="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="2_qoey7"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/simple_interactable_outline.tres" id="2_qoey7"]
[sub_resource type="CircleShape2D" id="CircleShape2D_npluf"]
resource_local_to_scene = true
+2
View File
@@ -17,6 +17,7 @@ run/max_fps=120
boot_splash/fullsize=false
boot_splash/image="uid://utam4axkvutc"
config/icon="uid://b2smanpdo1y5e"
boot_splash/minimum_display_time=1000
[audio]
@@ -30,6 +31,7 @@ InventoryManager="*res://scripts/CSharp/Common/Inventory/InventoryManager.cs"
Signal_Debugger="*res://addons/SignalVisualizer/Debugger/SignalDebugger.gd"
QuestManager="*res://scripts/CSharp/Common/Quest/QuestManager.cs"
FightManagerAutoload="*res://prefabs/fight/fight_manager_autoload.tscn"
InputService="*res://scripts/CSharp/Common/Services/InputService.cs"
[dialogic]
@@ -1080,6 +1080,9 @@ _blueprint = ExtResource("28_ipqaa")
[node name="CollisionShape3D" parent="YSorted/CanGenericPickup/PickupInteractionArea/Area2D" index="0"]
shape = SubResource("CircleShape2D_2065p")
[node name="Icon" parent="YSorted/CanGenericPickup" index="4"]
offset = Vector2(0, -50)
[node name="RakeGenericPickup" parent="YSorted" instance=ExtResource("25_hukxv")]
position = Vector2(8391, 2060)
@@ -7,7 +7,7 @@
[ext_resource type="Texture2D" uid="uid://waqmjrxduxfq" path="res://art/indoor/room export/Room_01_walls.png" id="5_sndxu"]
[ext_resource type="Texture2D" uid="uid://bqwhptcgg5ons" path="res://art/indoor/room export/Room_01_dorr_R.png" id="6_blyw3"]
[ext_resource type="Texture2D" uid="uid://vyk63d0pgqm5" path="res://art/indoor/room export/Room_01_dioor L.png" id="7_yd2gv"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="8_7a68a"]
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/simple_interactable_outline.tres" id="8_7a68a"]
[ext_resource type="Texture2D" uid="uid://b2rj7wkyu6ehy" path="res://art/indoor/room export/Room_01_pechka.png" id="8_ofqcg"]
[ext_resource type="Texture2D" uid="uid://dhvi5404cqioa" path="res://art/indoor/room export/Room_01_window.png" id="9_aoesu"]
[ext_resource type="Texture2D" uid="uid://bpi35nxbhput8" path="res://art/indoor/room export/Room_01_pechkaDoor.png" id="10_xcryd"]
@@ -1,48 +1,36 @@
using System.Threading.Tasks;
using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Common.Services;
using Godot;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
namespace Babushka.scripts.CSharp.Common.Animation;
public partial class Player2D : CharacterBody2D
public partial class VesnaAnimations : Node
{
[Export] private float _speed = 100f;
[Export] private AnimatedSprite2D _sprite;
[Export] private SceneTree.GroupCallFlags _fieldFlags;
[Export] private CpuParticles2D _wateringParticles;
[Export] private AnimatedSprite2D _sprite;
[Export] private CpuParticles2D _wateringParticles;
private bool anyActionPressed;
private string _toolString;
private int _toolID = -1; // -1 means no tool.
private Vector2 _lastDirection = Vector2.Zero;
public override void _Ready()
{
InventoryManager.Instance.playerInventory.InventoryContentsChanged += HandleNewItemInInventory;
}
// -1 means no tool.
private int _toolID = -1;
private string _toolString;
private bool anyActionPressed;
private bool _canHandleInput = true;
private Vector2 _lastDirection = Vector2.Zero;
private InventoryManager _inventoryManager;
public bool InputEnabled
{
get => _canHandleInput;
set => _canHandleInput = value;
}
public override void _Ready()
{
InventoryManager.Instance.playerInventory.InventoryContentsChanged += HandleNewItemInInventory;
}
private void HandleNewItemInInventory()
{
// for future Kathi: this does not, in fact, check if an item has been added only, but triggers on every content change!
PlayPickUpAnimation();
}
public override void _Process(double delta)
private void HandleNewItemInInventory()
{
// for future Kathi: this does not, in fact, check if an item has been added only, but triggers on every content change!
PlayPickUpAnimation();
}
public override void _Process(double delta)
{
anyActionPressed = false;
if (!_canHandleInput)
if (!InputService.Instance.InputEnabled)
return;
bool right = Input.IsActionPressed("move_right");
@@ -53,8 +41,6 @@ public partial class Player2D : CharacterBody2D
if (up)
{
Velocity = new Vector2(0, -_speed);
MoveAndSlide();
_sprite.Animation = "back walking" + _toolString;
anyActionPressed = true;
_lastDirection = Vector2.Up;
@@ -63,8 +49,6 @@ public partial class Player2D : CharacterBody2D
if (down && !walkingAnimationPicked)
{
Velocity = new Vector2(0, _speed);
MoveAndSlide();
_sprite.Animation = "front walking" + _toolString;
anyActionPressed = true;
_lastDirection = Vector2.Down;
@@ -73,8 +57,6 @@ public partial class Player2D : CharacterBody2D
if (right && !walkingAnimationPicked)
{
Velocity = new Vector2(_speed, 0);
MoveAndSlide();
_sprite.FlipH = false;
_sprite.Animation = "side walking" + _toolString;
anyActionPressed = true;
@@ -84,8 +66,6 @@ public partial class Player2D : CharacterBody2D
if (left && !walkingAnimationPicked)
{
Velocity = new Vector2(-_speed, 0);
MoveAndSlide();
_sprite.FlipH = true;
_sprite.Animation = "side walking" + _toolString;
anyActionPressed = true;
@@ -124,7 +104,7 @@ public partial class Player2D : CharacterBody2D
_sprite.Animation = "back idle" + _toolString;
}
}
public void ActivateTool(bool success, int id)
{
if (success)
@@ -146,17 +126,17 @@ public partial class Player2D : CharacterBody2D
break;
}
}
/// <summary>
/// Called by FarmingControls Signal.
/// </summary>
public void PlayWateringAnimation()
{
if (_toolID == 1 && _canHandleInput)
if (_toolID == 1 && InputService.Instance.InputEnabled)
{
_sprite.Animation = "diagonal wateringcan";
_sprite.Play();
_canHandleInput = false;
InputService.Instance.InputEnabled = false;
_wateringParticles.Emitting = true;
Task.Run(DelayedInputHandlerReset);
}
@@ -166,14 +146,14 @@ public partial class Player2D : CharacterBody2D
{
await Task.Delay(1000);
_wateringParticles.Emitting = false;
_canHandleInput = true;
InputService.Instance.InputEnabled = true;
}
public void PlayPickUpAnimation()
{
_sprite.Animation = "side pickup";
_sprite.Play();
_canHandleInput = false;
InputService.Instance.InputEnabled = false;
Task.Run(DelayedInputHandlerReset);
}
@@ -181,7 +161,7 @@ public partial class Player2D : CharacterBody2D
{
_sprite.Animation = "diagonal farming";
_sprite.Play();
_canHandleInput = false;
InputService.Instance.InputEnabled = false;
Task.Run(DelayedInputHandlerReset);
}
@@ -190,10 +170,9 @@ public partial class Player2D : CharacterBody2D
{
_sprite.Animation = "back interact";
_sprite.Play();
_canHandleInput = false;
_lastDirection = Vector2.Up;
InputService.Instance.InputEnabled = false;
Task.Run(DelayedInputHandlerReset);
}
}
}
@@ -0,0 +1 @@
uid://n7oihifvqp23
@@ -0,0 +1,65 @@
using System.Threading.Tasks;
using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Common.Services;
using Godot;
namespace Babushka.scripts.CSharp.Common.CharacterControls;
public partial class PlayerMovement : CharacterBody2D
{
[Export] private float _speed = 1000f;
private InventoryManager _inventoryManager;
public override void _Process(double delta)
{
bool anyActionPressed = false;
Vector2 currentVelocity = Vector2.Zero;
if (!InputService.Instance.InputEnabled)
return;
bool right = Input.IsActionPressed("move_right");
bool left = Input.IsActionPressed("move_left");
bool up = Input.IsActionPressed("move_up");
bool down = Input.IsActionPressed("move_down");
if (up)
{
currentVelocity += new Vector2(0, -_speed);
anyActionPressed = true;
}
if (down)
{
currentVelocity += new Vector2(0, _speed);
anyActionPressed = true;
}
if (right)
{
currentVelocity += new Vector2(_speed, 0);
anyActionPressed = true;
}
if (left)
{
currentVelocity += new Vector2(-_speed, 0);
anyActionPressed = true;
}
if (anyActionPressed)
{
if (currentVelocity.X != 0 && currentVelocity.Y != 0)
{
currentVelocity *= 0.7f;
}
Velocity = currentVelocity;
MoveAndSlide();
}
}
}
@@ -35,7 +35,7 @@ public partial class PlantBehaviour2D : Node2D
if (_field.FieldState != FieldState.Watered || _magicWordSaid != _magicWordNeeded)
return;
GetTree().CallGroup("PlantGrowing", Player2D.MethodName.PlayFarmingAnimation);
//GetTree().CallGroup("PlantGrowing", PlayerMovement.MethodName.PlayFarmingAnimation);
// todo:
// find out why the last plant stage is being skipped the second time around
switch (_state)
@@ -1,5 +1,7 @@
using Babushka.scripts.CSharp.Common.Animation;
using Babushka.scripts.CSharp.Common.CharacterControls;
using Babushka.scripts.CSharp.Common.Inventory;
using Babushka.scripts.CSharp.Common.Services;
using Godot;
namespace Babushka.scripts.CSharp.Common.Farming;
@@ -9,7 +11,8 @@ public partial class VesnaBehaviour2D : Node
[ExportGroup("Farming")]
[Export] private FieldService2D _fieldParent;
[Export] private FarmingControls2D _farmingControls;
[Export] private Player2D _player2d;
[Export] private PlayerMovement _player2d;
[Export] private VesnaAnimations _vesnaAnimations;
[Export] private ItemResource _hoe;
[Export] private ItemResource _wateringCan;
@@ -77,7 +80,7 @@ public partial class VesnaBehaviour2D : Node
if (toolId == 1)
{
_farmingControls.FillWateringCan();
_player2d.PlayWateringCanFillupAnimation();
_vesnaAnimations.PlayWateringCanFillupAnimation();
EmitSignal(SignalName.FilledWateringCan);
}
}
@@ -85,18 +88,18 @@ public partial class VesnaBehaviour2D : Node
#endregion
/// <summary>
/// Enables the character movement in the Player2D script.
/// Enables the input.
/// </summary>
public void EnableMovement()
{
_player2d.InputEnabled = true;
InputService.Instance.InputEnabled = true;
}
/// <summary>
/// Disables the character movement in the Player2D script.
/// Disables the input.
/// </summary>
public void DisableMovement()
{
_player2d.InputEnabled = false;
InputService.Instance.InputEnabled = false;
}
}
@@ -0,0 +1,37 @@
using Godot;
namespace Babushka.scripts.CSharp.Common.Services;
public partial class InputService : Node
{
public static InputService Instance { get; private set; } = null!;
[Signal]
public delegate void InputEnabledChangedEventHandler(bool enabled);
private static bool _inputEnabled = true;
public bool InputEnabled
{
get => _inputEnabled;
set
{
if (_inputEnabled != value)
{
CallDeferred(nameof(SetInputEnabled), value);
}
}
}
private void SetInputEnabled(bool enabled)
{
_inputEnabled = enabled;
EmitSignal(SignalName.InputEnabledChanged, _inputEnabled);
}
public override void _EnterTree()
{
Instance = this;
}
}
@@ -0,0 +1 @@
uid://blmbgmdv4aui8