Compare commits

...

5 Commits

Author SHA1 Message Date
Katharina Ziolkowski ba7d550c3f Implemented Save and Load functionality 2026-02-03 17:30:35 +01:00
Katharina Ziolkowski b65a3bbd6d Managed the freeing of entityplacers. Also cleaned up EntityManager 2026-02-03 15:36:59 +01:00
Katharina Ziolkowski bcbc074c86 First adjustments to the Entity System to make it work with different types 2026-02-03 13:55:13 +01:00
jonathan 745f54b375 WIP 2026-01-29 17:42:32 +01:00
jonathan 59d313d97d Added basic entity scripts 2025-12-18 14:27:27 +01:00
47 changed files with 15722 additions and 34 deletions
+3
View File
@@ -8,4 +8,7 @@
<Folder Include="prefabs\UI\Inventory\" />
<Folder Include="scripts\CSharp\Low Code\Randomizer\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
</Project>
@@ -4,19 +4,22 @@ importer="scene"
importer_version=1
type="PackedScene"
uid="uid://b3kyrsoobmkhp"
valid=false
path="res://.godot/imported/best_house_blender.blend-ac89c74aef2f275bdf4b4baadee17c0c.scn"
[deps]
source_file="res://art/mockups/3d/best_house_blender.blend"
dest_files=["res://.godot/imported/best_house_blender.blend-ac89c74aef2f275bdf4b4baadee17c0c.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
@@ -31,6 +34,9 @@ animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
@@ -50,3 +56,4 @@ blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true
gltf/naming_version=0
+45
View File
@@ -26,6 +26,15 @@
&"nicknames": ["vesna"],
&"offset": Vector2(-300, 0),
&"portraits": {
"angry": {
"export_overrides": {
"image": "\"res://art/characters/Vesna/angry.png\""
},
"mirror": false,
"offset": Vector2(150, 0),
"scale": 0.65,
"scene": ""
},
"front": {
"export_overrides": {
"image": "\"res://art/animation/Vesna2D/Vesna Anims Sequences/F01-Idle/0001.png\""
@@ -52,6 +61,42 @@
"offset": Vector2(0, 0),
"scale": 1.0,
"scene": ""
},
"sad": {
"export_overrides": {
"image": "\"res://art/characters/Vesna/sad.png\""
},
"mirror": false,
"offset": Vector2(150, 0),
"scale": 0.65,
"scene": ""
},
"smile": {
"export_overrides": {
"image": "\"res://art/characters/Vesna/smile.png\""
},
"mirror": false,
"offset": Vector2(150, 0),
"scale": 0.65,
"scene": ""
},
"surprise": {
"export_overrides": {
"image": "\"res://art/characters/Vesna/surprise.png\""
},
"mirror": false,
"offset": Vector2(150, 0),
"scale": 0.65,
"scene": ""
},
"surprised": {
"export_overrides": {
"image": "\"res://art/characters/Vesna/surprised.png\""
},
"mirror": false,
"offset": Vector2(150, 0),
"scale": 0.65,
"scene": ""
}
},
&"scale": 1.0
+15
View File
@@ -0,0 +1,15 @@
[gd_scene load_steps=4 format=3 uid="uid://hdfejdnmp8sl"]
[ext_resource type="Script" uid="uid://umop2b1m1qm8" path="res://scripts/CSharp/GameEntity/Management/EntityManager.cs" id="1_2bwns"]
[ext_resource type="Script" uid="uid://bogqp274y1pgr" path="res://scripts/CSharp/GameEntity/Management/EntityNodeCreator.cs" id="2_8m173"]
[ext_resource type="PackedScene" uid="uid://sbf12hin4kes" path="res://prefabs/Interactables/trash_object.tscn" id="3_v3vdc"]
[node name="EntityManager" type="Node" node_paths=PackedStringArray("_nodeCreator")]
script = ExtResource("1_2bwns")
_nodeCreator = NodePath("EntityCreator")
[node name="EntityCreator" type="Node" parent="."]
script = ExtResource("2_8m173")
_entityPrefabs = Dictionary[String, PackedScene]({
"TrashEntity": ExtResource("3_v3vdc")
})
+16 -1
View File
@@ -25,7 +25,7 @@ buses/default_bus_layout="uid://b6dwkmkyb0axk"
[autoload]
SceneTransition="*res://scenes/SceneTransition.tscn"
SceneTransition="*res://prefabs/UI/SceneTransition.tscn"
Dialogic="*res://addons/dialogic/Core/DialogicGameHandler.gd"
InventoryManager="*res://scripts/CSharp/Common/Inventory/InventoryManager.cs"
InputService="*res://scripts/CSharp/Common/Services/InputService.cs"
@@ -35,6 +35,7 @@ FightWorldAutoload="*res://prefabs/fight/fight_world_autoload.tscn"
SaveGameManager="*res://scripts/CSharp/Common/Savegame/SaveGameManager.cs"
SettingsSaveController="*res://scripts/CSharp/Common/Savegame/SettingsSaveController.cs"
DayAndNight="*res://prefabs/day_and_night/day_and_night.tscn"
EntityManager="*res://prefabs/entity_system/entity_manager.tscn"
[dialogic]
@@ -221,6 +222,10 @@ folder_colors={
"res://shader/": "pink"
}
[filesystem]
import/blender/enabled=false
[global_group]
Saveable=""
@@ -307,6 +312,16 @@ NextDayCheat={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
]
}
DebugEntities={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":66,"key_label":0,"unicode":98,"location":0,"echo":false,"script":null)
]
}
SaveGame={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194336,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[internationalization]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+445
View File
@@ -0,0 +1,445 @@
[gd_scene load_steps=9 format=3 uid="uid://b4uito2bnud2a"]
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_f5860"]
[ext_resource type="Texture2D" uid="uid://c7atj6ohlmir3" path="res://art/ui/StartScreen/titlescreen.png" id="1_kesja"]
[ext_resource type="Texture2D" uid="uid://du612t3xytly3" path="res://art/ui/StartScreen/babushkalog_white.png" id="2_f5860"]
[ext_resource type="Texture2D" uid="uid://cfrhmcyhs2i53" path="res://art/ui/UI/WhiteWashBackground.png" id="3_dvwtm"]
[ext_resource type="Texture2D" uid="uid://deitc84w2byyh" path="res://art/ui/nametag.png" id="4_a8kc7"]
[ext_resource type="FontFile" uid="uid://bgmdn7uo215q2" path="res://art/fonts/RuslanDisplay-Regular.ttf" id="5_gsl3s"]
[ext_resource type="Texture2D" uid="uid://blbplxfx41f8t" path="res://art/logos/Cozy Raven Logo breit.svg" id="6_l0rmr"]
[ext_resource type="Texture2D" uid="uid://cwbv2i8ntq15d" path="res://art/logos/FS_Logo_2zeilig_rot.png" id="7_03xwf"]
[node name="BabushkaSceneCredits" type="Node2D"]
script = ExtResource("1_f5860")
_sceneNamesToLoad = PackedStringArray("res://scenes/scene_bootstrap.tscn")
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(1030, 483)
scale = Vector2(0.535648, 0.535648)
texture = ExtResource("1_kesja")
[node name="BabushkaText" type="Sprite2D" parent="."]
position = Vector2(1387, 129)
scale = Vector2(0.349074, 0.349074)
texture = ExtResource("2_f5860")
[node name="WhiteWash" type="Sprite2D" parent="."]
modulate = Color(1, 1, 1, 0.0509804)
position = Vector2(1019, 930)
scale = Vector2(13.1172, 4.47852)
texture = ExtResource("3_dvwtm")
[node name="Node2D10" type="Node2D" parent="."]
position = Vector2(-18, 4)
scale = Vector2(0.93, 0.93)
[node name="Node2D2" type="Node2D" parent="Node2D10"]
position = Vector2(39, -100)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D2"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D2"]
offset_left = 296.0
offset_top = 250.0
offset_right = 898.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Producer"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D2"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D2"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Kathi"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D" type="Node2D" parent="Node2D10"]
position = Vector2(39, 15)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Programming"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Jonathan"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D3" type="Node2D" parent="Node2D10"]
position = Vector2(35, 130)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D3"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D3"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Sound Design"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D3"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D3"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Laura"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D4" type="Node2D" parent="Node2D10"]
position = Vector2(35, 244)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D4"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D4"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Project Manager"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D4"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D4"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Anna"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D5" type="Node2D" parent="Node2D10"]
position = Vector2(35, 356)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D5"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D5"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Art"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D5"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D5"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Alphawolfin"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D6" type="Node2D" parent="Node2D10"]
position = Vector2(35, 581)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D6"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D6"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Game Design"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D6"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D6"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Max"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D7" type="Node2D" parent="Node2D10"]
position = Vector2(35, 695)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D7"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D7"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Writer"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D7"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D7"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Sanel"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D8" type="Node2D" parent="Node2D10"]
position = Vector2(35, 469)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D8"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D8"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Animation"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D8"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D8"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Felix"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Node2D9" type="Node2D" parent="Node2D10"]
position = Vector2(35, 807)
scale = Vector2(0.5, 0.5)
[node name="Nametag2" type="Sprite2D" parent="Node2D10/Node2D9"]
position = Vector2(596.045, 303)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label2" type="Label" parent="Node2D10/Node2D9"]
offset_left = 295.0
offset_top = 250.0
offset_right = 897.0
offset_bottom = 377.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Music"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag3" type="Sprite2D" parent="Node2D10/Node2D9"]
position = Vector2(3726.91, 187.387)
scale = Vector2(0.636364, 0.636364)
texture = ExtResource("4_a8kc7")
[node name="Label3" type="Label" parent="Node2D10/Node2D9"]
offset_left = 3425.86
offset_top = 134.387
offset_right = 4027.86
offset_bottom = 261.387
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 56
text = "Gefördert durch"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Nametag" type="Sprite2D" parent="Node2D10/Node2D9"]
position = Vector2(595, 408)
texture = ExtResource("4_a8kc7")
[node name="Label" type="Label" parent="Node2D10/Node2D9"]
offset_left = 124.0
offset_top = 359.0
offset_right = 1072.0
offset_bottom = 486.0
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_constants/shadow_offset_x = 0
theme_override_constants/shadow_offset_y = 0
theme_override_fonts/font = ExtResource("5_gsl3s")
theme_override_font_sizes/font_size = 80
text = "Felix"
horizontal_alignment = 1
vertical_alignment = 1
[node name="CozyRavenLogoBreit" type="Sprite2D" parent="."]
position = Vector2(1044.13, 876.875)
scale = Vector2(0.150709, 0.150709)
texture = ExtResource("6_l0rmr")
[node name="fums Logo" type="Sprite2D" parent="."]
position = Vector2(1751, 917)
scale = Vector2(0.496692, 0.496693)
texture = ExtResource("7_03xwf")
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="Button" type="Button" parent="CanvasLayer"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -75.0
offset_bottom = 71.0
grow_horizontal = 0
alignment = 2
[connection signal="pressed" from="CanvasLayer/Button" to="." method="LoadScene"]
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+172
View File
@@ -0,0 +1,172 @@
[gd_scene load_steps=19 format=3 uid="uid://botol7aqw81n7"]
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_c6eln"]
[ext_resource type="Texture2D" uid="uid://cugtxcfuds31r" path="res://art/indoor/Babushka_bg_01.png" id="2_j25a2"]
[ext_resource type="Script" uid="uid://cldtt4atgymm5" path="res://scripts/CSharp/Common/Quest/QuestTrigger.cs" id="8_j25a2"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="8_phqdf"]
[ext_resource type="Resource" uid="uid://csj15gnlx1jmx" path="res://resources/quests/demo/8_goto_bed.tres" id="9_heyef"]
[ext_resource type="Texture2D" path="res://art/indoor/vesna_indoor_bed.png" id="10_hryl5"]
[ext_resource type="Script" uid="uid://puw74w6lmcvl" path="res://scripts/CSharp/Common/Fight/NightStarter.cs" id="10_j25a2"]
[ext_resource type="Texture2D" path="res://art/indoor/vesna_indoor_door.png" id="11_axs81"]
[ext_resource type="Script" uid="uid://jg4jryfus3bw" path="res://scripts/CSharp/Common/DayAndNight/DayAndNightHelper.cs" id="11_heyef"]
[ext_resource type="Texture2D" uid="uid://cop1vjvhwlsec" path="res://art/indoor/room export/Room_01_shelf.png" id="13_11fdt"]
[ext_resource type="Texture2D" uid="uid://bleimj6jr1jka" path="res://art/general/rectangle.png" id="14_axs81"]
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Vesna.tscn" id="18_3gevq"]
[ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="23_408bg"]
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="24_xwo8y"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_l0jrn"]
resource_local_to_scene = true
size = Vector2(3836, 1086)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2spkc"]
size = Vector2(238.25, 189.75)
[sub_resource type="CircleShape2D" id="CircleShape2D_phqdf"]
resource_local_to_scene = true
radius = 381.93
[sub_resource type="CircleShape2D" id="CircleShape2D_2spkc"]
resource_local_to_scene = true
radius = 509.071
[node name="VesnasRoom" type="Node2D"]
y_sort_enabled = true
script = ExtResource("1_c6eln")
_sceneNamesToLoad = PackedStringArray("res://scenes/scene_indoor_common_room.tscn", "res://scenes/scene_fight_world_room.tscn")
[node name="Colliders" type="Node2D" parent="."]
position = Vector2(1297, 5292)
scale = Vector2(4, 4)
[node name="SideColliderLeft" type="StaticBody2D" parent="Colliders"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Colliders/SideColliderLeft"]
position = Vector2(-2892, -1168)
shape = SubResource("RectangleShape2D_l0jrn")
[node name="SideColliderRight" type="StaticBody2D" parent="Colliders"]
position = Vector2(4858, 0)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Colliders/SideColliderRight"]
position = Vector2(-2892, -1168)
shape = SubResource("RectangleShape2D_l0jrn")
[node name="TopCollider" type="StaticBody2D" parent="Colliders"]
position = Vector2(2448.75, -595)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Colliders/TopCollider"]
position = Vector2(-2892, -1168)
shape = SubResource("RectangleShape2D_l0jrn")
[node name="BottomCollider" type="StaticBody2D" parent="Colliders"]
position = Vector2(2495.5, 757.75)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Colliders/BottomCollider"]
position = Vector2(-2892, -1168)
shape = SubResource("RectangleShape2D_l0jrn")
[node name="BedCollider" type="StaticBody2D" parent="Colliders"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Colliders/BedCollider"]
position = Vector2(-828.625, -1230.38)
shape = SubResource("RectangleShape2D_2spkc")
[node name="BackWall" type="Node" parent="."]
[node name="Room01Walls2" type="Sprite2D" parent="BackWall"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -100
position = Vector2(4992, -487)
scale = Vector2(2, 2)
texture = ExtResource("2_j25a2")
offset = Vector2(-2768, 264)
[node name="Room01Shelf" type="Sprite2D" parent="BackWall"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -50
position = Vector2(-1978, -678)
texture = ExtResource("13_11fdt")
region_enabled = true
region_rect = Rect2(1846, 471, 348, 490)
[node name="Vesna" parent="." instance=ExtResource("18_3gevq")]
position = Vector2(-471, 185)
[node name="Camera2D" type="Camera2D" parent="." node_paths=PackedStringArray("_followNode")]
position = Vector2(-1534, -26)
offset = Vector2(0, -200)
zoom = Vector2(0.5, 0.5)
limit_left = -2600
limit_top = -1400
limit_right = 1500
limit_bottom = 1400
editor_draw_limits = true
script = ExtResource("23_408bg")
_followNode = NodePath("../Vesna/CharacterBody2D")
[node name="CanvasLayer" parent="." instance=ExtResource("24_xwo8y")]
[node name="BedInteraction" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("8_phqdf")]
position = Vector2(-1415, 489)
_spritesToOutline = [NodePath("Bedsprite")]
_id = 1
[node name="CollisionShape3D" parent="BedInteraction/Area2D" index="0"]
position = Vector2(-382, 9)
shape = SubResource("CircleShape2D_phqdf")
[node name="QuestCompleter" type="Node" parent="BedInteraction"]
script = ExtResource("8_j25a2")
questResource = ExtResource("9_heyef")
toStatus = 2
[node name="Bedsprite" type="Sprite2D" parent="BedInteraction"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -99
position = Vector2(4925, -967)
scale = Vector2(2, 2)
texture = ExtResource("10_hryl5")
offset = Vector2(-2768, 264)
region_rect = Rect2(36.702454, 566.3165, 492.73346, 422.25665)
[node name="DoorInteraction" parent="." node_paths=PackedStringArray("_spritesToOutline") instance=ExtResource("8_phqdf")]
position = Vector2(777, 201)
_spritesToOutline = [NodePath("Doorsprite")]
_id = 0
[node name="CollisionShape3D" parent="DoorInteraction/Area2D" index="0"]
shape = SubResource("CircleShape2D_2spkc")
[node name="Doorsprite" type="Sprite2D" parent="DoorInteraction"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -99
position = Vector2(5559, -961)
scale = Vector2(2, 2)
texture = ExtResource("11_axs81")
offset = Vector2(-2768, 264)
region_rect = Rect2(1517.5891, 258.72107, 356.62732, 741.81134)
[node name="NightStarter" type="Node" parent="."]
script = ExtResource("10_j25a2")
_sceneIndexToLoad = 1
[node name="CountDayUp" type="Node" parent="NightStarter"]
script = ExtResource("11_heyef")
[node name="PointLight2D" type="PointLight2D" parent="."]
position = Vector2(-630, -568)
scale = Vector2(2.5, 1.3)
color = Color(1, 0.73333335, 0.69803923, 1)
energy = 1.86
texture = ExtResource("14_axs81")
[connection signal="Interacted" from="BedInteraction" to="BedInteraction/QuestCompleter" method="Trigger"]
[connection signal="Interacted" from="BedInteraction" to="NightStarter" method="StartNight"]
[connection signal="Interacted" from="BedInteraction" to="NightStarter/CountDayUp" method="IncreaseDayCount"]
[connection signal="Interacted" from="DoorInteraction" to="." method="LoadScene"]
[connection signal="LoadScene" from="NightStarter" to="." method="LoadSceneAtIndex"]
[editable path="Vesna"]
[editable path="BedInteraction"]
[editable path="DoorInteraction"]
File diff suppressed because it is too large Load Diff
@@ -186,7 +186,7 @@ public partial class PlantBehaviour2D : Node2D
private void SetActiveHarvestablePlant(bool active)
{
_harvestablePlant.IsActive = active;
//_harvestablePlant.IsActive = active;
_harvestablePlant.UpdateVisuals();
}
@@ -1,10 +1,13 @@
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Godot;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.Common.Inventory;
// Do not instantiate this resource
// But it has to be a resource because Godot
[GlobalClass]
public partial class ItemInstance: Resource
public partial class ItemInstance : Resource, IJsonSerializable
{
[Export] public required ItemResource blueprint;
[Export] public int amount = 1;
@@ -17,4 +20,18 @@ public partial class ItemInstance: Resource
amount = amount
};
}
}
public void LoadFromJson(JObject json)
{
var blueprintPath = json.GetStringValue("blueprint");
blueprint = GD.Load<ItemResource>(blueprintPath);
amount = json.GetIntValue("amount");
}
public JObject SaveToJson()
{
return new(
new JProperty("blueprint", blueprint.ResourcePath),
new JProperty("amount", amount));
}
}
@@ -1,23 +1,19 @@
using Babushka.scripts.CSharp.Common.Savegame;
using Babushka.scripts.CSharp.GameEntity.Entities;
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Godot;
using Godot.Collections;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.Common.Inventory;
public partial class ItemOnGround2D : Node, ISaveable
public partial class ItemOnGround2D : Node2D
{
private ItemInstance _itemInstance;
[Export] public bool IsActive = true;
[Export] private bool _infiniteSupply = false;
[Export] private int _finiteSupply = 1;
[Export] private bool _saveToDisk = true;
private int pickUpCounter = 0;
[Signal] public delegate void SuccessfulPickUpEventHandler();
private Label _itemLabel => GetNode<Label>("ItemLabel");
private Label _pickupErrorLabel => GetNode<Label>("PickupErrorLabel");
private Sprite2D _iconSprite => GetNode<Sprite2D>("Icon");
@@ -34,16 +30,12 @@ public partial class ItemOnGround2D : Node, ISaveable
public override void _Ready()
{
LoadFromSaveData();
UpdateVisuals();
_pickupErrorLabel.Text = "";
}
public void TryPickUp()
{
if (!IsActive)
return;
var result = InventoryManager.Instance.CollectItem(itemInstance.Clone());
EmitSignal(SignalName.SuccessfulPickUp);
if (result == InventoryActionResult.Success)
@@ -58,16 +50,7 @@ public partial class ItemOnGround2D : Node, ISaveable
private void Pickup()
{
if (!_infiniteSupply)
{
pickUpCounter++;
if (pickUpCounter >= _finiteSupply)
{
QueueFree();
}
UpdateSaveData();
}
// remove from entity manager
}
private void FailToPickup()
@@ -80,9 +63,6 @@ public partial class ItemOnGround2D : Node, ISaveable
public void UpdateVisuals()
{
if (!IsActive)
return;
_iconSprite.Texture = itemInstance?.blueprint?.icon;
if (_iconSprite.Texture == null)
{
@@ -94,7 +74,22 @@ public partial class ItemOnGround2D : Node, ISaveable
}
}
// todo: What do we do with instances that are created at runtime?
/*
protected override void LoadEntity(JObject json)
{
base.LoadEntity(json);
_itemInstance.LoadFromJson(json.GetObject("item"));
}
protected override void SaveEntity(JObject json)
{
base.SaveEntity(json);
json["item"] = _itemInstance.SaveToJson();
}
*/
// old save
/*
public void UpdateSaveData()
{
if (!_saveToDisk)
@@ -157,5 +152,5 @@ public partial class ItemOnGround2D : Node, ISaveable
}
}
}
}
}*/
}
@@ -1,4 +1,6 @@
using Godot;
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Godot;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.Common.Inventory;
@@ -0,0 +1,27 @@
using System;
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.Entities;
public class Entity
{
public long id;
public virtual string EntityType => "";
public Entity()
{
id = new Random().NextInt64();
}
public virtual void SaveEntity(JObject json)
{
json["id"] = id;
json["type"] = EntityType;
}
public virtual void LoadEntity(JObject json)
{
id = json.GetLongValue("id");
}
}
@@ -0,0 +1 @@
uid://hnmpt23ovfgl
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Transactions;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.Entities;
public class LoadedScenesEntity : Entity
{
private HashSet<string> _loadedScenes = new();
public override string EntityType => OWN_TYPE_NAME;
public const string OWN_TYPE_NAME = "LoadedScenesEntity";
public void AddScene(string sceneName) => _loadedScenes.Add(sceneName);
public bool WasSceneLoaded(string sceneName) => _loadedScenes.Contains(sceneName);
public override void SaveEntity(JObject json)
{
base.SaveEntity(json);
json["scenes"] = new JArray(_loadedScenes);
}
public override void LoadEntity(JObject json)
{
base.LoadEntity(json);
JArray array = (JArray?) json["scenes"] ?? throw new Exception("No scenes found in LoadedScenesEntity.");
_loadedScenes = array.ToObject<HashSet<string>>()!;
}
}
@@ -0,0 +1 @@
uid://rabb1y637cm5
@@ -0,0 +1,32 @@
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Godot;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.Entities;
public abstract class PositionalEntity : Entity
{
public Vector2 position;
public string sceneName = "none";
public override void SaveEntity(JObject json)
{
base.SaveEntity(json);
json["posx"] = position.X;
json["posy"] = position.Y;
json["scene"] = sceneName;
}
public override void LoadEntity(JObject json)
{
base.LoadEntity(json);
position = new Vector2(
json.GetFloatValue("posx"),
json.GetFloatValue("posy"));
sceneName = json.GetStringValue("scene");
}
// Deals with Instantiation of the node
public abstract void InstantiateEntityNode(Node2D parent);
}
@@ -0,0 +1 @@
uid://bs38dulqv7sop
@@ -0,0 +1,23 @@
using Babushka.scripts.CSharp.GameEntity.Management;
using Godot;
namespace Babushka.scripts.CSharp.GameEntity.Entities;
public class TrashEntity : PositionalEntity
{
public override string EntityType => OWN_TYPE_NAME;
public const string OWN_TYPE_NAME = "TrashEntity";
private EntityNodeCreator _creator;
public TrashEntity()
{
}
public override void InstantiateEntityNode(Node2D parent)
{
if(_creator == null) _creator = EntityManager.Instance.NodeCreator;
var entityNode = _creator.InstantiateNode(EntityType);
parent.AddChild(entityNode);
entityNode.GlobalPosition = position;
}
}
@@ -0,0 +1 @@
uid://c31k34epunk5t
@@ -0,0 +1,16 @@
using Babushka.scripts.CSharp.GameEntity.Entities;
using Godot;
namespace Babushka.scripts.CSharp.GameEntity.EntityNodes;
public partial class TrashEntityNode : Node2D
{
private TrashEntity _trashEntity;
public void Initialize(TrashEntity trashEntity)
{
_trashEntity = trashEntity;
}
}
@@ -0,0 +1 @@
uid://d3n8kwva4pxx5
@@ -0,0 +1,26 @@
using Babushka.scripts.CSharp.GameEntity.Entities;
using Babushka.scripts.CSharp.GameEntity.Management;
using Godot;
namespace Babushka.scripts.CSharp.GameEntity.EntityPlacer;
public partial class TrashEntityPlacer : Node2D
{
private string _trashEntityType = TrashEntity.OWN_TYPE_NAME;
public override void _Ready()
{
string sceneName = EntityManager.Instance.CurrentEntitySceneContainer!.sceneName;
var loadedScenesEntity = EntityManager.Instance.GetUniqueEntity<LoadedScenesEntity>();
if (!loadedScenesEntity.WasSceneLoaded(sceneName))
{
TrashEntity entity = new TrashEntity();
entity.sceneName = sceneName;
entity.position = GlobalPosition;
EntityManager.Instance.AddEntity(entity);
}
QueueFree();
}
}
@@ -0,0 +1 @@
uid://bilg7e33usxuv
@@ -0,0 +1,44 @@
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.LoadSave;
public static class EntityLoadSaveUtil
{
private static void AssertTokenType(this JObject json, string key, JTokenType type)
{
var token = json[key];
if (token == null) throw new MalformedJsonException(json, key, "does not exist");
//if (!token.HasValues) throw new MalformedJsonException(json, key, "has no value");
if (token.Type != type) throw new MalformedJsonException(json, key, $"is not of type {type}");
}
public static long GetLongValue(this JObject json, string key)
{
AssertTokenType(json, key, JTokenType.Integer);
return json.Value<long>(key);
}
public static int GetIntValue(this JObject json, string key)
{
AssertTokenType(json, key, JTokenType.Integer);
return json.Value<int>(key);
}
public static float GetFloatValue(this JObject json, string key)
{
AssertTokenType(json, key, JTokenType.Float);
return json.Value<float>(key);
}
public static JObject GetObject(this JObject json, string key)
{
AssertTokenType(json, key, JTokenType.Object);
return json.Value<JObject>(key)!;
}
public static string GetStringValue(this JObject json, string key)
{
AssertTokenType(json, key, JTokenType.String);
return json.Value<string>(key)!;
}
}
@@ -0,0 +1 @@
uid://ccu6p418viliu
@@ -0,0 +1,9 @@
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.LoadSave;
public interface IJsonSerializable
{
public void LoadFromJson(JObject json);
public JObject SaveToJson();
}
@@ -0,0 +1 @@
uid://cuma3347l55mb
@@ -0,0 +1,12 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.GameEntity.LoadSave;
public class MalformedJsonException(JObject actualJson, string key, string problem) : Exception
{
public override string Message => $"JsonObject was malformed: {key} {problem}";
public override IDictionary Data => new Dictionary<string, JObject> { { "json", actualJson } };
}
@@ -0,0 +1 @@
uid://d1o066hh84ow
@@ -0,0 +1,157 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Babushka.scripts.CSharp.GameEntity.Entities;
using Godot;
using Newtonsoft.Json.Linq;
using Entity = Babushka.scripts.CSharp.GameEntity.Entities.Entity;
using PositionalEntity = Babushka.scripts.CSharp.GameEntity.Entities.PositionalEntity;
namespace Babushka.scripts.CSharp.GameEntity.Management;
/// <summary>
/// Manages the lifecycle and interactions of all entities within the game, including their creation, retrieval,
/// and organization. The EntityManager serves as a centralized hub for managing both standard and positional entities.
/// </summary>
public partial class EntityManager : Node
{
public static EntityManager Instance;
[Export] private EntityNodeCreator _nodeCreator = null!;
[Export] private string saveDirectory = "user://save_data/";
private EntitySceneContainer? _currentEntitySceneContainer;
private readonly List<Entity> _allEntities = new();
public IEnumerable<Entity> AllEntities => _allEntities;
public IEnumerable<PositionalEntity> AllPositionalEntities => _allEntities.OfType<PositionalEntity>();
public EntitySceneContainer? CurrentEntitySceneContainer => _currentEntitySceneContainer;
public EntityNodeCreator NodeCreator => _nodeCreator;
public override void _EnterTree()
{
Instance = this;
Load();
}
public override void _Input(InputEvent @event)
{
// for debugging purposes
if (@event.IsActionPressed("DebugEntities"))
{
GD.Print("Entities:");
foreach (var entity in AllEntities)
{
GD.Print(entity.EntityType + " " + entity.id);
}
}
if(@event.IsActionPressed("SaveGame")) Save();
}
public void Save()
{
JArray array = new JArray();
foreach (var entity in AllEntities)
{
JObject saveData = new JObject();
entity.SaveEntity(saveData);
array.Add(saveData);
}
using var SaveFile = FileAccess.Open(saveDirectory + "save.json", FileAccess.ModeFlags.Write);
SaveFile.StoreString(array.ToString());
}
public void Load()
{
using var saveFile = FileAccess.Open(saveDirectory + "save.json", FileAccess.ModeFlags.Read);
if (saveFile == null) return;
JArray array = JArray.Parse(saveFile.GetAsText());
foreach (var token in array)
{
var jobj = (JObject)token;
if (jobj == null) continue;
if (jobj.TryGetValue("type", out var entityType))
{
string entityTypeString = (string) entityType!;
Entity entity = InitializeEntity(entityTypeString);
entity.LoadEntity(jobj);
AddEntity(entity);
}
}
}
private Entity InitializeEntity(string type)
{
Entity entity = type switch
{
TrashEntity.OWN_TYPE_NAME => new TrashEntity(),
LoadedScenesEntity.OWN_TYPE_NAME => new LoadedScenesEntity(),
_ => throw new Exception($"Trying to load unknown entity type: {type}")
};
return entity;
}
#region ENTITY MANAGEMENT
/// <summary>
/// Adds an entity to the list of managed entities. If the entity is a positional entity
/// and its scene matches the current scene container, it is also instantiated in the scene.
/// </summary>
/// <param name="entity">The entity to be added to the manager.</param>
public void AddEntity(Entity entity)
{
if (!_allEntities.Contains(entity))
_allEntities.Add(entity);
if(entity is PositionalEntity positionalEntity && positionalEntity.sceneName == _currentEntitySceneContainer?.sceneName)
InstantiatePositionalEntityNode(positionalEntity);
}
private void InstantiatePositionalEntityNode(PositionalEntity entity)
{
if(_currentEntitySceneContainer == null) return;
entity.InstantiateEntityNode(_currentEntitySceneContainer);
}
/// <summary>
/// Retrieves the first entity of the specified type from the list of managed entities.
/// If no such entity exists, creates a new instance of the specified type, adds it to the manager, and returns it.
/// </summary>
/// <typeparam name="T">The type of entity to retrieve or create. Must inherit from the Entity class and have a parameterless constructor.</typeparam>
/// <returns>The first entity of the specified type or a newly created entity of that type if none were found.</returns>
public T GetUniqueEntity<T>() where T : Entity, new()
{
var result = AllEntities.OfType<T>().FirstOrDefault();
if (result == null)
{
var newEntity = new T();
AddEntity(newEntity);
result = newEntity;
}
return result;
}
#endregion
#region SCENE CONTAINER ACCESS
public void SetSceneContainer(EntitySceneContainer sceneContainer)
{
_currentEntitySceneContainer = sceneContainer;
}
public void UnsetSceneContainer()
{
_currentEntitySceneContainer = null;
}
#endregion
}
@@ -0,0 +1 @@
uid://umop2b1m1qm8
@@ -0,0 +1,14 @@
using PositionalEntity = Babushka.scripts.CSharp.GameEntity.Entities.PositionalEntity;
namespace Babushka.scripts.CSharp.GameEntity.Management;
public static class EntityManagerUtil
{
public static void AddIfNeeded(this EntitySceneContainer? self, PositionalEntity entity)
{
if(self == null) return;
if(self.sceneName != entity.sceneName) return;
self.AddEntity(entity);
}
}
@@ -0,0 +1 @@
uid://dc3283h7sx4cl
@@ -0,0 +1,25 @@
using System;
using Godot;
using Godot.Collections;
namespace Babushka.scripts.CSharp.GameEntity.Management;
public partial class EntityNodeCreator : Node
{
[Export] private Dictionary<string, PackedScene> _entityPrefabs;
public Node2D InstantiateNode(string type)
{
if (string.IsNullOrEmpty(type))
{
throw new NullReferenceException("The type provided for Node instantiation cannot be null or empty.");
}
if (!_entityPrefabs.ContainsKey(type))
{
throw new Exception($"The type provided for Node instantiation ({type}) is not specified in the EntityNodeCreator dictionary.");
}
return _entityPrefabs[type].Instantiate<Node2D>();
}
}
@@ -0,0 +1 @@
uid://bogqp274y1pgr
@@ -0,0 +1,48 @@
using System.Linq;
using Babushka.scripts.CSharp.GameEntity.Entities;
using Godot;
using PositionalEntity = Babushka.scripts.CSharp.GameEntity.Entities.PositionalEntity;
namespace Babushka.scripts.CSharp.GameEntity.Management;
public partial class EntitySceneContainer : Node2D
{
[Export] public string sceneName = "none";
public override void _EnterTree()
{
EntityManager.Instance.SetSceneContainer(this);
}
public override void _ExitTree()
{
EntityManager.Instance.Save();
EntityManager.Instance.UnsetSceneContainer();
}
public override void _Ready()
{
AddAllEntities();
CallDeferred(nameof(RegisterWithScenesEntity));
}
private void RegisterWithScenesEntity()
{
var loadedScenesEntity = EntityManager.Instance.GetUniqueEntity<LoadedScenesEntity>();
loadedScenesEntity.AddScene(sceneName);
}
public void AddAllEntities()
{
foreach (var positionalEntity in EntityManager.Instance.AllPositionalEntities.Where(x => x.sceneName == sceneName))
{
AddEntity(positionalEntity);
}
}
public void AddEntity(PositionalEntity entity)
{
entity.InstantiateEntityNode(this);
}
}
@@ -0,0 +1 @@
uid://ca1pg6k3gn47y
+9
View File
@@ -12,6 +12,9 @@ uniform float brightness_add : hint_range(-1.0, 1.0) = 0.0;
// Contrast multiplier in RGB space. 1.0 means no change.
uniform float contrast_mult : hint_range(0.0, 2.0) = 1.0;
//Cached Color value to reapply modulate
varying vec4 modulate;
// Converts an RGB color to HSV.
vec3 rgb2hsv(vec3 c) {
float cMax = max(max(c.r, c.g), c.b);
@@ -65,6 +68,10 @@ vec3 hsv2rgb(vec3 c) {
return rgb + vec3(m);
}
void vertex(){
modulate = COLOR;
}
void fragment() {
// Get the original texture color.
vec4 tex_color = texture(TEXTURE, UV);
@@ -89,4 +96,6 @@ void fragment() {
// Output the final color while preserving the original alpha.
COLOR = vec4(col, tex_color.a);
//reapply vertex color value to keep modulate changes
COLOR = COLOR * modulate;
}
+6
View File
@@ -2,8 +2,14 @@ shader_type canvas_item;
uniform vec2 tiling_scale = vec2(5.0, 5.0);
uniform sampler2D noise : repeat_enable;
varying vec4 modulate;
void vertex() {
modulate = COLOR;
}
void fragment() {
vec2 uv = vec2(UV.x * tiling_scale.x, UV.y * tiling_scale.y); // Change 10.0 to control tiling scale
COLOR = texture(TEXTURE, fract(uv));
COLOR = COLOR * modulate;
}
+8
View File
@@ -26,6 +26,9 @@ uniform float heightOffset : hint_range(0.0, 1.0);
// With the offset value, you can if you want different moves for each asset. Just put a random value (1, 2, 3) in the editor. Don't forget to mark the material as unique if you use this
uniform float offset = 0;
// caching color settings to reapply modulate value
varying vec4 modulate;
float getWind(vec2 vertex, vec2 uv, float time){
float diff = pow(maxStrength - minStrength, 2.0);
float strength = clamp(minStrength + diff + sin(time / interval) * diff, minStrength, maxStrength) * strengthScale;
@@ -47,8 +50,13 @@ float noise(vec2 x) {
}
void vertex() {
modulate = COLOR;
vec4 pos = MODEL_MATRIX * vec4(0.0, 0.0, 0.0, 1.0);
//float time = TIME * speed + sin(VERTEX.x * noise(VERTEX.xy) * offset);
float time = TIME * speed + sin(pos.x * offset) * cos( pos.x * offset) ;
VERTEX.x += getWind(VERTEX.xy, UV, time);
}
void fragment() {
COLOR = modulate * COLOR;
}