Added Wellbehaviour and fixed door interaction to offer outlines
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://ccy6bwunhfvrf"
|
||||||
|
path="res://.godot/imported/Babushka_house_frontDoor.png-345830acb7ae8cbbb97011f89455fd91.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://art/farm/Babushka_house_frontDoor.png"
|
||||||
|
dest_files=["res://.godot/imported/Babushka_house_frontDoor.png-345830acb7ae8cbbb97011f89455fd91.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=105 format=3 uid="uid://gigb28qk8t12"]
|
[gd_scene load_steps=108 format=3 uid="uid://gigb28qk8t12"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="1_7wfwe"]
|
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Player2D.tscn" id="1_7wfwe"]
|
||||||
[ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"]
|
[ext_resource type="Texture2D" uid="uid://8sr11ex30n0m" path="res://art/mockups/Kenney_Backgrounds/Samples/uncolored_hills.png" id="2_7b2ri"]
|
||||||
@@ -37,13 +37,16 @@
|
|||||||
[ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/wateringcan.tres" id="28_ipqaa"]
|
[ext_resource type="Resource" uid="uid://cndd64batns31" path="res://resources/items/wateringcan.tres" id="28_ipqaa"]
|
||||||
[ext_resource type="Resource" uid="uid://datee0flk1e84" path="res://resources/items/scythe.tres" id="29_wtdui"]
|
[ext_resource type="Resource" uid="uid://datee0flk1e84" path="res://resources/items/scythe.tres" id="29_wtdui"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="32_2nee2"]
|
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="32_2nee2"]
|
||||||
|
[ext_resource type="Script" uid="uid://boehox1ydbcnx" path="res://scripts/CSharp/Common/Farming/WellBehaviour.cs" id="32_lbnqo"]
|
||||||
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="34_e5b7x"]
|
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="34_e5b7x"]
|
||||||
[ext_resource type="Texture2D" uid="uid://65e44yde224q" path="res://art/farm/Babushka_house_01.png" id="36_e5b7x"]
|
[ext_resource type="Texture2D" uid="uid://65e44yde224q" path="res://art/farm/Babushka_house_01.png" id="36_e5b7x"]
|
||||||
[ext_resource type="AudioStream" uid="uid://cfqg50am0swb7" path="res://audio/Music/Farming_90BPM_69Bars_Loop.wav" id="37_8ey8m"]
|
[ext_resource type="AudioStream" uid="uid://cfqg50am0swb7" path="res://audio/Music/Farming_90BPM_69Bars_Loop.wav" id="37_8ey8m"]
|
||||||
[ext_resource type="AudioStream" uid="uid://dku1rq5cocisg" path="res://audio/Music/Farming_90BPM_69Bars.wav" id="37_di1ed"]
|
[ext_resource type="AudioStream" uid="uid://dku1rq5cocisg" path="res://audio/Music/Farming_90BPM_69Bars.wav" id="37_di1ed"]
|
||||||
[ext_resource type="Shader" uid="uid://braevmqauoek7" path="res://shader/swaying_plant.gdshader" id="37_taxvr"]
|
[ext_resource type="Shader" uid="uid://braevmqauoek7" path="res://shader/swaying_plant.gdshader" id="37_taxvr"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bq2wojyy4ptva" path="res://art/nature/baum märz 2025/sonnenblume7.png" id="38_2rjny"]
|
[ext_resource type="Texture2D" uid="uid://bq2wojyy4ptva" path="res://art/nature/baum märz 2025/sonnenblume7.png" id="38_2rjny"]
|
||||||
|
[ext_resource type="Material" uid="uid://blch5kdhkbj75" path="res://art/materials/intaractable_outline.tres" id="38_tm0yg"]
|
||||||
[ext_resource type="AudioStream" uid="uid://fsiypqhql67w" path="res://audio/sfx/Farming/SFX_GettingWater_01.wav" id="39_di1ed"]
|
[ext_resource type="AudioStream" uid="uid://fsiypqhql67w" path="res://audio/sfx/Farming/SFX_GettingWater_01.wav" id="39_di1ed"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ccy6bwunhfvrf" path="res://art/farm/Babushka_house_frontDoor.png" id="39_lbnqo"]
|
||||||
[ext_resource type="AudioStream" uid="uid://foyw26hq1qp5" path="res://audio/sfx/Farming/SFX_GettingWater_02.wav" id="40_ceriq"]
|
[ext_resource type="AudioStream" uid="uid://foyw26hq1qp5" path="res://audio/sfx/Farming/SFX_GettingWater_02.wav" id="40_ceriq"]
|
||||||
[ext_resource type="Script" uid="uid://cfnrd5k1k0gxw" path="res://scripts/CSharp/Common/AudioPlayer.cs" id="40_w3jkj"]
|
[ext_resource type="Script" uid="uid://cfnrd5k1k0gxw" path="res://scripts/CSharp/Common/AudioPlayer.cs" id="40_w3jkj"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dgavbfci8x178" path="res://art/nature/grass/grass-1.png" id="41_apj51"]
|
[ext_resource type="Texture2D" uid="uid://dgavbfci8x178" path="res://art/nature/grass/grass-1.png" id="41_apj51"]
|
||||||
@@ -1031,7 +1034,7 @@ _wateringCan = ExtResource("28_ipqaa")
|
|||||||
[node name="FarmingControls" parent="YSorted/Vesna" index="1" node_paths=PackedStringArray("_camera")]
|
[node name="FarmingControls" parent="YSorted/Vesna" index="1" node_paths=PackedStringArray("_camera")]
|
||||||
_camera = NodePath("../../../Camera2D")
|
_camera = NodePath("../../../Camera2D")
|
||||||
|
|
||||||
[node name="Brünnen" type="Sprite2D" parent="YSorted"]
|
[node name="Brünnen" type="Sprite2D" parent="YSorted" node_paths=PackedStringArray("_interactionArea")]
|
||||||
z_index = 1
|
z_index = 1
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
material = SubResource("ShaderMaterial_2vojv")
|
material = SubResource("ShaderMaterial_2vojv")
|
||||||
@@ -1040,6 +1043,8 @@ texture = ExtResource("21_ualyd")
|
|||||||
offset = Vector2(0, -800)
|
offset = Vector2(0, -800)
|
||||||
region_enabled = true
|
region_enabled = true
|
||||||
region_rect = Rect2(0, 0, 1504, 1686)
|
region_rect = Rect2(0, 0, 1504, 1686)
|
||||||
|
script = ExtResource("32_lbnqo")
|
||||||
|
_interactionArea = NodePath("InteractionArea")
|
||||||
|
|
||||||
[node name="StaticBody2D" type="StaticBody2D" parent="YSorted/Brünnen"]
|
[node name="StaticBody2D" type="StaticBody2D" parent="YSorted/Brünnen"]
|
||||||
collision_mask = 4
|
collision_mask = 4
|
||||||
@@ -1048,7 +1053,10 @@ collision_mask = 4
|
|||||||
position = Vector2(145.5, -224)
|
position = Vector2(145.5, -224)
|
||||||
shape = SubResource("RectangleShape2D_0sfl7")
|
shape = SubResource("RectangleShape2D_0sfl7")
|
||||||
|
|
||||||
[node name="InteractionArea" parent="YSorted/Brünnen" instance=ExtResource("27_klb81")]
|
[node name="InteractionArea" parent="YSorted/Brünnen" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("27_klb81")]
|
||||||
|
_active = false
|
||||||
|
_outlineMaterial = ExtResource("38_tm0yg")
|
||||||
|
_spriteToOutline = NodePath("..")
|
||||||
_id = 1
|
_id = 1
|
||||||
|
|
||||||
[node name="CollisionShape3D" parent="YSorted/Brünnen/InteractionArea/Area2D" index="0"]
|
[node name="CollisionShape3D" parent="YSorted/Brünnen/InteractionArea/Area2D" index="0"]
|
||||||
@@ -1124,13 +1132,18 @@ collision_mask = 6
|
|||||||
position = Vector2(-252.56, 231.32)
|
position = Vector2(-252.56, 231.32)
|
||||||
polygon = PackedVector2Array(247.227, 43.5123, 44.7822, 43.5123, -87.2178, 45.123, -104.329, -55.2797, -154.107, -73.5347, -160.107, -380.38, -175.44, -400.783, -63.44, -512.461, 97.8934, -541.991, 261.671, -599.172, 374.782, -526.421, 502.338, -526.421, 637.893, -396.488, 598.56, -360.783, 596.338, -58.2327, 528.782, -58.2327, 501.449, 45.9283)
|
polygon = PackedVector2Array(247.227, 43.5123, 44.7822, 43.5123, -87.2178, 45.123, -104.329, -55.2797, -154.107, -73.5347, -160.107, -380.38, -175.44, -400.783, -63.44, -512.461, 97.8934, -541.991, 261.671, -599.172, 374.782, -526.421, 502.338, -526.421, 637.893, -396.488, 598.56, -360.783, 596.338, -58.2327, 528.782, -58.2327, 501.449, 45.9283)
|
||||||
|
|
||||||
[node name="EnterHouseInteraction" parent="YSorted/Farm visuals/Static" instance=ExtResource("27_klb81")]
|
[node name="EnterHouseInteraction" parent="YSorted/Farm visuals/Static" node_paths=PackedStringArray("_spriteToOutline") instance=ExtResource("27_klb81")]
|
||||||
position = Vector2(5839, 2349)
|
position = Vector2(5839, 2349)
|
||||||
scale = Vector2(2.425, 2.425)
|
scale = Vector2(2.425, 2.425)
|
||||||
_useOutline = false
|
_outlineMaterial = ExtResource("38_tm0yg")
|
||||||
_useSprite = false
|
_spriteToOutline = NodePath("DoorSprite")
|
||||||
_id = 0
|
_id = 0
|
||||||
|
|
||||||
|
[node name="DoorSprite" type="Sprite2D" parent="YSorted/Farm visuals/Static/EnterHouseInteraction"]
|
||||||
|
position = Vector2(0.412364, -33.1959)
|
||||||
|
scale = Vector2(1.8649, 1.54554)
|
||||||
|
texture = ExtResource("39_lbnqo")
|
||||||
|
|
||||||
[node name="greenery" type="Node2D" parent="YSorted/Farm visuals/Static"]
|
[node name="greenery" type="Node2D" parent="YSorted/Farm visuals/Static"]
|
||||||
|
|
||||||
[node name="left side" type="Node2D" parent="YSorted/Farm visuals/Static/greenery"]
|
[node name="left side" type="Node2D" parent="YSorted/Farm visuals/Static/greenery"]
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
||||||
@@ -6,6 +7,7 @@ public partial class InteractionArea2D : Node2D
|
|||||||
{
|
{
|
||||||
[Export] private Area2D _area;
|
[Export] private Area2D _area;
|
||||||
[Export] private Label _label;
|
[Export] private Label _label;
|
||||||
|
[Export] private bool _active = true;
|
||||||
[Export] private bool _useOutline = true;
|
[Export] private bool _useOutline = true;
|
||||||
[Export] private ShaderMaterial _outlineMaterial;
|
[Export] private ShaderMaterial _outlineMaterial;
|
||||||
[Export] private bool _useSprite = true;
|
[Export] private bool _useSprite = true;
|
||||||
@@ -17,17 +19,32 @@ public partial class InteractionArea2D : Node2D
|
|||||||
[Signal] public delegate void InteractedToolEventHandler(int id); // TODO: remove
|
[Signal] public delegate void InteractedToolEventHandler(int id); // TODO: remove
|
||||||
[Signal] public delegate void InteractedEventHandler();
|
[Signal] public delegate void InteractedEventHandler();
|
||||||
|
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive
|
||||||
|
{
|
||||||
|
get => _active;
|
||||||
|
set => _active = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
if(_useSprite && _useOutline)
|
if (_useSprite && _useOutline)
|
||||||
_backupMaterial = _spriteToOutline.Material;
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_backupMaterial = _spriteToOutline.Material;
|
||||||
|
}
|
||||||
|
catch(Exception exception)
|
||||||
|
{
|
||||||
|
GD.PrintErr($"No sprite to outline found on: {GetParent().Name}" + exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPlayerEntered(Node2D player)
|
public void OnPlayerEntered(Node2D player)
|
||||||
{
|
{
|
||||||
if (!IsActive)
|
if (!_active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(_showLabel)
|
if(_showLabel)
|
||||||
@@ -41,7 +58,7 @@ public partial class InteractionArea2D : Node2D
|
|||||||
|
|
||||||
public void OnPlayerExited(Node2D player)
|
public void OnPlayerExited(Node2D player)
|
||||||
{
|
{
|
||||||
if (!IsActive)
|
if (!_active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_label.Hide();
|
_label.Hide();
|
||||||
@@ -54,31 +71,34 @@ public partial class InteractionArea2D : Node2D
|
|||||||
|
|
||||||
public override void _Input(InputEvent @event)
|
public override void _Input(InputEvent @event)
|
||||||
{
|
{
|
||||||
if (!IsActive)
|
if (!_active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (@event.IsAction("interact") && @event.IsPressed() && _area.HasOverlappingBodies())
|
if (@event.IsAction("interact") && @event.IsPressed())
|
||||||
{
|
{
|
||||||
_label.Hide();
|
if (_area.HasOverlappingBodies())
|
||||||
|
{
|
||||||
|
_label.Hide();
|
||||||
|
|
||||||
if (_useSprite && _useOutline)
|
if (_useSprite && _useOutline)
|
||||||
_spriteToOutline.Material = _backupMaterial;
|
_spriteToOutline.Material = _backupMaterial;
|
||||||
|
|
||||||
EmitSignal(SignalName.InteractedTool, _id);
|
EmitSignal(SignalName.InteractedTool, _id);
|
||||||
EmitSignal(SignalName.Interacted);
|
EmitSignal(SignalName.Interacted);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSpriteActiveState(bool success, int id) // TODO: remove
|
public void SetSpriteActiveState(bool success, int id) // TODO: remove
|
||||||
{
|
{
|
||||||
GD.PrintErr("SetSpriteActiveState is being called.");
|
GD.PrintErr("SetSpriteActiveState is being called.");
|
||||||
if(!IsActive)
|
if(!_active)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleActive()
|
public void ToggleActive()
|
||||||
{
|
{
|
||||||
IsActive = !IsActive;
|
_active = !_active;
|
||||||
_label.Hide();
|
_label.Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cqtlic8xxtvkc
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dw5dl5yscbyaw
|
||||||
@@ -24,6 +24,10 @@ public static class WateringCanState
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool Active = false;
|
public static bool Active = false;
|
||||||
|
|
||||||
|
public delegate void WateringCanDelegate(bool state);
|
||||||
|
public static event WateringCanDelegate WateringCanActiveStateChanged;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resets the fillstate to the max amount.
|
/// Resets the fillstate to the max amount.
|
||||||
@@ -65,6 +69,8 @@ public static class WateringCanState
|
|||||||
/// <param name="active"></param>
|
/// <param name="active"></param>
|
||||||
public static void SetActive(bool active)
|
public static void SetActive(bool active)
|
||||||
{
|
{
|
||||||
|
if(active != Active)
|
||||||
|
WateringCanActiveStateChanged?.Invoke(active);
|
||||||
Active = active;
|
Active = active;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using Babushka.scripts.CSharp.Common.CharacterControls;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Babushka.scripts.CSharp.Common.Farming;
|
||||||
|
|
||||||
|
public partial class WellBehaviour : Node2D
|
||||||
|
{
|
||||||
|
[Export] private InteractionArea2D _interactionArea;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
WateringCanState.WateringCanActiveStateChanged += OnWateringCanStateChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnWateringCanStateChanged(bool state)
|
||||||
|
{
|
||||||
|
_interactionArea.IsActive = state;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://boehox1ydbcnx
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cnggo5jyimosu
|
||||||
Reference in New Issue
Block a user