Compare commits

..

8 Commits

Author SHA1 Message Date
Jonathan 628da80ed3 Merge pull request 'feature/entity_rework' (#52) from feature/entity_rework into develop
2 months ago
Katharina Ziolkowski 0dfbd73978 Reverted ItemOnGround to make everything compile again
2 months ago
Katharina Ziolkowski 8a93b00e72 Merge branch 'develop' into feature/entity_rework
2 months ago
Katharina Ziolkowski ba7d550c3f Implemented Save and Load functionality
2 months ago
Katharina Ziolkowski b65a3bbd6d Managed the freeing of entityplacers. Also cleaned up EntityManager
2 months ago
Katharina Ziolkowski bcbc074c86 First adjustments to the Entity System to make it work with different types
2 months ago
jonathan 745f54b375 WIP
2 months ago
jonathan 59d313d97d Added basic entity scripts
4 months ago

@ -8,4 +8,7 @@
<Folder Include="prefabs\UI\Inventory\" /> <Folder Include="prefabs\UI\Inventory\" />
<Folder Include="scripts\CSharp\Low Code\Randomizer\" /> <Folder Include="scripts\CSharp\Low Code\Randomizer\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
</Project> </Project>

@ -4,19 +4,22 @@ importer="scene"
importer_version=1 importer_version=1
type="PackedScene" type="PackedScene"
uid="uid://b3kyrsoobmkhp" uid="uid://b3kyrsoobmkhp"
valid=false path="res://.godot/imported/best_house_blender.blend-ac89c74aef2f275bdf4b4baadee17c0c.scn"
[deps] [deps]
source_file="res://art/mockups/3d/best_house_blender.blend" source_file="res://art/mockups/3d/best_house_blender.blend"
dest_files=["res://.godot/imported/best_house_blender.blend-ac89c74aef2f275bdf4b4baadee17c0c.scn"]
[params] [params]
nodes/root_type="" nodes/root_type=""
nodes/root_name="" nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
@ -31,6 +34,9 @@ animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={} _subresources={}
blender/nodes/visible=0 blender/nodes/visible=0
blender/nodes/active_collection_only=false blender/nodes/active_collection_only=false
@ -50,3 +56,4 @@ blender/materials/export_materials=1
blender/animation/limit_playback=true blender/animation/limit_playback=true
blender/animation/always_sample=true blender/animation/always_sample=true
blender/animation/group_tracks=true blender/animation/group_tracks=true
gltf/naming_version=0

@ -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")
})

@ -35,6 +35,7 @@ FightWorldAutoload="*res://prefabs/fight/fight_world_autoload.tscn"
SaveGameManager="*res://scripts/CSharp/Common/Savegame/SaveGameManager.cs" SaveGameManager="*res://scripts/CSharp/Common/Savegame/SaveGameManager.cs"
SettingsSaveController="*res://scripts/CSharp/Common/Savegame/SettingsSaveController.cs" SettingsSaveController="*res://scripts/CSharp/Common/Savegame/SettingsSaveController.cs"
DayAndNight="*res://prefabs/day_and_night/day_and_night.tscn" DayAndNight="*res://prefabs/day_and_night/day_and_night.tscn"
EntityManager="*res://prefabs/entity_system/entity_manager.tscn"
[dialogic] [dialogic]
@ -224,6 +225,10 @@ folder_colors={
"res://shader/": "pink" "res://shader/": "pink"
} }
[filesystem]
import/blender/enabled=false
[global_group] [global_group]
Saveable="" Saveable=""
@ -310,6 +315,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) "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] [internationalization]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -897,15 +897,6 @@ scale = Vector2(3.25, 1)
skew = 1.309 skew = 1.309
texture = ExtResource("25_l6ca2") texture = ExtResource("25_l6ca2")
[node name="EndLeft3" type="Sprite2D" parent="Fence"]
texture_repeat = 2
material = SubResource("ShaderMaterial_ualyd")
position = Vector2(8133.001, 2924.0042)
rotation = -1.5847566
scale = Vector2(3.619918, 1.0631187)
skew = 1.1688291
texture = ExtResource("25_l6ca2")
[node name="EndLeft2" type="Sprite2D" parent="Fence"] [node name="EndLeft2" type="Sprite2D" parent="Fence"]
texture_repeat = 2 texture_repeat = 2
material = SubResource("ShaderMaterial_ualyd") material = SubResource("ShaderMaterial_ualyd")
@ -1004,7 +995,7 @@ position = Vector2(146, -130)
shape = SubResource("CircleShape2D_p6n74") shape = SubResource("CircleShape2D_p6n74")
[node name="CanGenericPickup" parent="YSorted" instance=ExtResource("32_cw83k")] [node name="CanGenericPickup" parent="YSorted" instance=ExtResource("32_cw83k")]
position = Vector2(6855, 3507) position = Vector2(8192, 3507)
metadata/SaveID = "5a823507-8107-40ce-8b32-6d0f81a3c44e" metadata/SaveID = "5a823507-8107-40ce-8b32-6d0f81a3c44e"
[node name="SpawnWithItem" parent="YSorted/CanGenericPickup" index="0"] [node name="SpawnWithItem" parent="YSorted/CanGenericPickup" index="0"]
@ -1020,7 +1011,7 @@ shape = SubResource("CircleShape2D_2065p")
offset = Vector2(0, -50) offset = Vector2(0, -50)
[node name="RakeGenericPickup" parent="YSorted" instance=ExtResource("32_cw83k")] [node name="RakeGenericPickup" parent="YSorted" instance=ExtResource("32_cw83k")]
position = Vector2(4738, 2042) position = Vector2(8391, 2060)
metadata/SaveID = "e13886b1-2131-4072-bc06-7d8abb19357b" metadata/SaveID = "e13886b1-2131-4072-bc06-7d8abb19357b"
[node name="SpawnWithItem" parent="YSorted/RakeGenericPickup" index="0"] [node name="SpawnWithItem" parent="YSorted/RakeGenericPickup" index="0"]
@ -1033,7 +1024,6 @@ metadata/SaveID = "c148aa78-114b-4770-a040-8498483edb1d"
shape = SubResource("CircleShape2D_tm0yg") shape = SubResource("CircleShape2D_tm0yg")
[node name="SeedPickup" parent="YSorted" instance=ExtResource("32_cw83k")] [node name="SeedPickup" parent="YSorted" instance=ExtResource("32_cw83k")]
visible = false
position = Vector2(9927, 2257) position = Vector2(9927, 2257)
_finiteSupply = 3 _finiteSupply = 3
metadata/SaveID = "e1bbe13f-0622-42b8-97f3-87a8af369dc0" metadata/SaveID = "e1bbe13f-0622-42b8-97f3-87a8af369dc0"
@ -1051,7 +1041,6 @@ shape = SubResource("CircleShape2D_tm0yg")
scale = Vector2(1, 1) scale = Vector2(1, 1)
[node name="SeedPickup2" parent="YSorted" instance=ExtResource("32_cw83k")] [node name="SeedPickup2" parent="YSorted" instance=ExtResource("32_cw83k")]
visible = false
position = Vector2(10705, 2257) position = Vector2(10705, 2257)
_finiteSupply = 3 _finiteSupply = 3
metadata/SaveID = "77972c50-63a7-461a-bc7d-6fa46333bc5c" metadata/SaveID = "77972c50-63a7-461a-bc7d-6fa46333bc5c"
@ -2243,20 +2232,6 @@ position = Vector2(9259, 3194)
_penTarget = NodePath("../../pen/penSlot2") _penTarget = NodePath("../../pen/penSlot2")
metadata/SaveID = "94c8a740-2745-4162-91e7-66f36b8681e0" metadata/SaveID = "94c8a740-2745-4162-91e7-66f36b8681e0"
[node name="Duck8" parent="YSorted/ducks" node_paths=PackedStringArray("_penTarget") instance=ExtResource("50_6330x")]
z_index = 0
y_sort_enabled = false
position = Vector2(10459, 2630)
_penTarget = NodePath("../../pen/penSlot2")
metadata/SaveID = "94c8a740-2745-4162-91e7-66f36b8681e0"
[node name="Duck9" parent="YSorted/ducks" node_paths=PackedStringArray("_penTarget") instance=ExtResource("50_6330x")]
z_index = 0
y_sort_enabled = false
position = Vector2(12411, 2979)
_penTarget = NodePath("../../pen/penSlot2")
metadata/SaveID = "94c8a740-2745-4162-91e7-66f36b8681e0"
[node name="Duck4" parent="YSorted/ducks" node_paths=PackedStringArray("_penTarget") instance=ExtResource("50_6330x")] [node name="Duck4" parent="YSorted/ducks" node_paths=PackedStringArray("_penTarget") instance=ExtResource("50_6330x")]
z_index = 0 z_index = 0
y_sort_enabled = false y_sort_enabled = false
@ -2320,7 +2295,6 @@ position = Vector2(-4659, 2897)
position = Vector2(-5016, 3361) position = Vector2(-5016, 3361)
[node name="trash" type="Node2D" parent="YSorted"] [node name="trash" type="Node2D" parent="YSorted"]
visible = false
z_index = 1 z_index = 1
y_sort_enabled = true y_sort_enabled = true
position = Vector2(-569, -42) position = Vector2(-569, -42)
@ -2328,13 +2302,13 @@ position = Vector2(-569, -42)
[node name="trashObject" parent="YSorted/trash" instance=ExtResource("53_j4nx2")] [node name="trashObject" parent="YSorted/trash" instance=ExtResource("53_j4nx2")]
z_index = 0 z_index = 0
y_sort_enabled = false y_sort_enabled = false
position = Vector2(10051, 3026) position = Vector2(1269, 3170)
metadata/SaveID = "f6bf35b0-a145-4a8d-a946-38dc6ee53507" metadata/SaveID = "f6bf35b0-a145-4a8d-a946-38dc6ee53507"
[node name="trashObject2" parent="YSorted/trash" instance=ExtResource("53_j4nx2")] [node name="trashObject2" parent="YSorted/trash" instance=ExtResource("53_j4nx2")]
z_index = 0 z_index = 0
y_sort_enabled = false y_sort_enabled = false
position = Vector2(13710, 2355) position = Vector2(3183, 2369)
offset = Vector2(1, -50) offset = Vector2(1, -50)
region_rect = Rect2(207, 1184, 149, 142) region_rect = Rect2(207, 1184, 149, 142)
metadata/SaveID = "1b175e9c-f4a6-4b30-b024-95ab1a6c4ec7" metadata/SaveID = "1b175e9c-f4a6-4b30-b024-95ab1a6c4ec7"
@ -2342,7 +2316,7 @@ metadata/SaveID = "1b175e9c-f4a6-4b30-b024-95ab1a6c4ec7"
[node name="trashObject3" parent="YSorted/trash" instance=ExtResource("53_j4nx2")] [node name="trashObject3" parent="YSorted/trash" instance=ExtResource("53_j4nx2")]
z_index = 0 z_index = 0
y_sort_enabled = false y_sort_enabled = false
position = Vector2(13463, 3519) position = Vector2(4724, 3519)
offset = Vector2(1, -50) offset = Vector2(1, -50)
region_rect = Rect2(400, 1053, 163, 141) region_rect = Rect2(400, 1053, 163, 141)
metadata/SaveID = "28770149-73d5-45bd-b760-6e84a07c59b8" metadata/SaveID = "28770149-73d5-45bd-b760-6e84a07c59b8"
@ -2350,7 +2324,7 @@ metadata/SaveID = "28770149-73d5-45bd-b760-6e84a07c59b8"
[node name="trashObject4" parent="YSorted/trash" instance=ExtResource("53_j4nx2")] [node name="trashObject4" parent="YSorted/trash" instance=ExtResource("53_j4nx2")]
z_index = 0 z_index = 0
y_sort_enabled = false y_sort_enabled = false
position = Vector2(14239, 2353) position = Vector2(5385, 3391)
offset = Vector2(1, -50) offset = Vector2(1, -50)
region_rect = Rect2(1048, 1092, 348, 106) region_rect = Rect2(1048, 1092, 348, 106)
metadata/SaveID = "1cbdfeb5-68d4-4489-896e-7879e7baa26f" metadata/SaveID = "1cbdfeb5-68d4-4489-896e-7879e7baa26f"
@ -2358,7 +2332,7 @@ metadata/SaveID = "1cbdfeb5-68d4-4489-896e-7879e7baa26f"
[node name="trashObject5" parent="YSorted/trash" instance=ExtResource("53_j4nx2")] [node name="trashObject5" parent="YSorted/trash" instance=ExtResource("53_j4nx2")]
z_index = 0 z_index = 0
y_sort_enabled = false y_sort_enabled = false
position = Vector2(15935, 2541) position = Vector2(8051, 2541)
offset = Vector2(1, -50) offset = Vector2(1, -50)
region_rect = Rect2(531, 1207, 176, 167) region_rect = Rect2(531, 1207, 176, 167)
metadata/SaveID = "b6bdce90-0b79-45c8-a2d1-3078a58d3314" metadata/SaveID = "b6bdce90-0b79-45c8-a2d1-3078a58d3314"
@ -2526,8 +2500,6 @@ script = ExtResource("79_m37ba")
[connection signal="GoalReached" from="YSorted/ducks" to="YSorted/ducks/DialogicToggle" method="ToggleDialogue"] [connection signal="GoalReached" from="YSorted/ducks" to="YSorted/ducks/DialogicToggle" method="ToggleDialogue"]
[connection signal="DuckCollected" from="YSorted/ducks/Duck2" to="YSorted/ducks" method="Increment"] [connection signal="DuckCollected" from="YSorted/ducks/Duck2" to="YSorted/ducks" method="Increment"]
[connection signal="DuckCollected" from="YSorted/ducks/Duck3" to="YSorted/ducks" method="Increment"] [connection signal="DuckCollected" from="YSorted/ducks/Duck3" to="YSorted/ducks" method="Increment"]
[connection signal="DuckCollected" from="YSorted/ducks/Duck8" to="YSorted/ducks" method="Increment"]
[connection signal="DuckCollected" from="YSorted/ducks/Duck9" to="YSorted/ducks" method="Increment"]
[connection signal="DuckCollected" from="YSorted/ducks/Duck4" to="YSorted/ducks" method="Increment"] [connection signal="DuckCollected" from="YSorted/ducks/Duck4" to="YSorted/ducks" method="Increment"]
[connection signal="DuckCollected" from="YSorted/ducks/Duck5" to="YSorted/ducks" method="Increment"] [connection signal="DuckCollected" from="YSorted/ducks/Duck5" to="YSorted/ducks" method="Increment"]
[connection signal="DuckCollected" from="YSorted/ducks/Duck6" to="YSorted/ducks" method="Increment"] [connection signal="DuckCollected" from="YSorted/ducks/Duck6" to="YSorted/ducks" method="Increment"]

@ -1,4 +1,4 @@
[gd_scene load_steps=109 format=3 uid="uid://bsaworp0kp2gb"] [gd_scene load_steps=109 format=3 uid="uid://cfax63b8gwgjf"]
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_yi67q"] [ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_yi67q"]
[ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="2_8skws"] [ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="2_8skws"]
@ -1016,7 +1016,6 @@ modulate = Color(0.24313726, 0.1882353, 0.5294118, 1)
[node name="SeedPickup" parent="YSorted" instance=ExtResource("32_lcoqd")] [node name="SeedPickup" parent="YSorted" instance=ExtResource("32_lcoqd")]
visible = false visible = false
position = Vector2(9927, 2257) position = Vector2(9927, 2257)
_finiteSupply = 3
metadata/SaveID = "e1bbe13f-0622-42b8-97f3-87a8af369dc0" metadata/SaveID = "e1bbe13f-0622-42b8-97f3-87a8af369dc0"
[node name="SpawnWithItem" parent="YSorted/SeedPickup" index="0"] [node name="SpawnWithItem" parent="YSorted/SeedPickup" index="0"]
@ -1037,7 +1036,6 @@ scale = Vector2(1, 1)
[node name="SeedPickup2" parent="YSorted" instance=ExtResource("32_lcoqd")] [node name="SeedPickup2" parent="YSorted" instance=ExtResource("32_lcoqd")]
visible = false visible = false
position = Vector2(10705, 2257) position = Vector2(10705, 2257)
_finiteSupply = 3
metadata/SaveID = "77972c50-63a7-461a-bc7d-6fa46333bc5c" metadata/SaveID = "77972c50-63a7-461a-bc7d-6fa46333bc5c"
[node name="SpawnWithItem" parent="YSorted/SeedPickup2" index="0"] [node name="SpawnWithItem" parent="YSorted/SeedPickup2" index="0"]

@ -228,7 +228,7 @@ _sceneNamesToLoad = PackedStringArray("res://scenes/scene_indoor_vesnas_room.tsc
[node name="Table" type="Sprite2D" parent="Foreground"] [node name="Table" type="Sprite2D" parent="Foreground"]
z_index = 2 z_index = 2
y_sort_enabled = true y_sort_enabled = true
position = Vector2(-1883, 1051) position = Vector2(-1888, 1112)
texture = ExtResource("2_ufnxe") texture = ExtResource("2_ufnxe")
offset = Vector2(0, -200) offset = Vector2(0, -200)
region_enabled = true region_enabled = true
@ -237,7 +237,7 @@ region_rect = Rect2(1012, 1743, 1470, 417)
[node name="Chair" type="Sprite2D" parent="Foreground"] [node name="Chair" type="Sprite2D" parent="Foreground"]
z_index = 3 z_index = 3
y_sort_enabled = true y_sort_enabled = true
position = Vector2(-3037, 2025) position = Vector2(-3032, 2096)
texture = ExtResource("3_pejp6") texture = ExtResource("3_pejp6")
offset = Vector2(216, -1064) offset = Vector2(216, -1064)
region_enabled = true region_enabled = true
@ -245,14 +245,13 @@ region_rect = Rect2(1534, 1976, 379, 184)
[node name="Chair2" type="Sprite2D" parent="Foreground"] [node name="Chair2" type="Sprite2D" parent="Foreground"]
y_sort_enabled = true y_sort_enabled = true
position = Vector2(-1069, 2013) position = Vector2(-1064, 2064)
texture = ExtResource("3_pejp6") texture = ExtResource("3_pejp6")
offset = Vector2(184, -1056) offset = Vector2(184, -1056)
region_enabled = true region_enabled = true
region_rect = Rect2(1534, 1976, 379, 184) region_rect = Rect2(1534, 1976, 379, 184)
[node name="Samowar" type="Sprite2D" parent="Foreground"] [node name="Samowar" type="Sprite2D" parent="Foreground"]
visible = false
z_index = 1 z_index = 1
y_sort_enabled = true y_sort_enabled = true
position = Vector2(-1904, 1192) position = Vector2(-1904, 1192)
@ -564,12 +563,12 @@ region_rect = Rect2(2748, 432, 174, 191)
[node name="Vesna" parent="." instance=ExtResource("26_yq173")] [node name="Vesna" parent="." instance=ExtResource("26_yq173")]
y_sort_enabled = false y_sort_enabled = false
position = Vector2(-2296, 573) position = Vector2(-4473, 319)
[node name="Yeli" parent="." instance=ExtResource("27_pfr1s")] [node name="Yeli" parent="." instance=ExtResource("27_pfr1s")]
z_index = 0 z_index = 0
y_sort_enabled = false y_sort_enabled = false
position = Vector2(-1258, 648) position = Vector2(-2841, 198)
_timelinesToPlay = PackedStringArray("yeli_intro_05") _timelinesToPlay = PackedStringArray("yeli_intro_05")
[node name="InteractionArea" parent="Yeli" index="0"] [node name="InteractionArea" parent="Yeli" index="0"]

@ -1,11 +1,9 @@
[gd_scene load_steps=12 format=3 uid="uid://bvp5ju36h1vl2"] [gd_scene load_steps=10 format=3 uid="uid://bvp5ju36h1vl2"]
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_ftmt4"] [ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_ftmt4"]
[ext_resource type="Texture2D" uid="uid://da67c7avarwq2" path="res://art/indoor/kitchen_bgAssets.png" id="2_qsw8g"] [ext_resource type="Texture2D" uid="uid://da67c7avarwq2" path="res://art/indoor/kitchen_bgAssets.png" id="2_qsw8g"]
[ext_resource type="Texture2D" uid="uid://x7trh4dgsvoe" path="res://art/indoor/room export/Room_01_assets.png" id="5_3wvmt"] [ext_resource type="Texture2D" uid="uid://x7trh4dgsvoe" path="res://art/indoor/room export/Room_01_assets.png" id="5_3wvmt"]
[ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="7_6mpmc"] [ext_resource type="PackedScene" uid="uid://cqc72e4hq6bcd" path="res://prefabs/interactions/interaction_area_2d.tscn" id="7_6mpmc"]
[ext_resource type="PackedScene" uid="uid://dfvgp1my5rydh" path="res://prefabs/characters/Yeli.tscn" id="8_6asqd"]
[ext_resource type="Texture2D" uid="uid://djewfwrdt4iv3" path="res://art/ui/UI/icons/icon-fruit-beetroot.png" id="9_nd6ln"]
[ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Vesna.tscn" id="25_58hm8"] [ext_resource type="PackedScene" uid="uid://c25udixd5m6l0" path="res://prefabs/characters/Vesna.tscn" id="25_58hm8"]
[ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="30_wqpex"] [ext_resource type="Script" uid="uid://bqomwxclsbhd3" path="res://scripts/CSharp/Common/Camera/CameraController.cs" id="30_wqpex"]
[ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="31_jyyyu"] [ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="31_jyyyu"]
@ -217,14 +215,14 @@ _followNode = NodePath("../Vesna/CharacterBody2D")
[node name="cupboard" type="Sprite2D" parent="BackItems"] [node name="cupboard" type="Sprite2D" parent="BackItems"]
z_index = -10 z_index = -10
position = Vector2(-352.5, 153) position = Vector2(-2071, 114)
texture = ExtResource("2_qsw8g") texture = ExtResource("2_qsw8g")
region_enabled = true region_enabled = true
region_rect = Rect2(1359, 440, 1591, 401) region_rect = Rect2(1359, 440, 1591, 401)
[node name="wallshelf" type="Sprite2D" parent="BackItems"] [node name="wallshelf" type="Sprite2D" parent="BackItems"]
z_index = -10 z_index = -10
position = Vector2(10.5, -296) position = Vector2(-1708, -335)
texture = ExtResource("2_qsw8g") texture = ExtResource("2_qsw8g")
region_enabled = true region_enabled = true
region_rect = Rect2(3037, 440, 701, 170) region_rect = Rect2(3037, 440, 701, 170)
@ -248,7 +246,6 @@ region_rect = Rect2(2748, 432, 174, 191)
[node name="FrontItems" type="Node2D" parent="."] [node name="FrontItems" type="Node2D" parent="."]
z_index = 50 z_index = 50
position = Vector2(-28, -119)
[node name="Stove" type="Sprite2D" parent="FrontItems"] [node name="Stove" type="Sprite2D" parent="FrontItems"]
position = Vector2(-2482, 926) position = Vector2(-2482, 926)
@ -277,14 +274,6 @@ texture = ExtResource("2_qsw8g")
region_enabled = true region_enabled = true
region_rect = Rect2(1599, 1107, 1351, 418) region_rect = Rect2(1599, 1107, 1351, 418)
[node name="Yeli" parent="." instance=ExtResource("8_6asqd")]
position = Vector2(-2694, 989)
[node name="IconFruitBeetroot" type="Sprite2D" parent="."]
position = Vector2(-625, -73)
rotation = -1.0380759
texture = ExtResource("9_nd6ln")
[connection signal="InteractedTool" from="Background/Room01DoorL/CommonRoomDoor" to="." method="LoadSceneAtIndex"] [connection signal="InteractedTool" from="Background/Room01DoorL/CommonRoomDoor" to="." method="LoadSceneAtIndex"]
[connection signal="Interacted" from="FrontItems/Stove/Firetoggle" to="FrontItems/Stove/Fireleft" method="hide"] [connection signal="Interacted" from="FrontItems/Stove/Firetoggle" to="FrontItems/Stove/Fireleft" method="hide"]
[connection signal="Interacted" from="FrontItems/Stove/Firetoggle" to="FrontItems/Stove/FireRight" method="hide"] [connection signal="Interacted" from="FrontItems/Stove/Firetoggle" to="FrontItems/Stove/FireRight" method="hide"]

@ -1,4 +1,4 @@
[gd_scene load_steps=19 format=3 uid="uid://ceaa2qj2bmw43"] [gd_scene load_steps=18 format=3 uid="uid://ceaa2qj2bmw43"]
[ext_resource type="Script" uid="uid://cssdu8viimwm6" path="res://scripts/CSharp/Common/SceneTransition.cs" id="1_c6eln"] [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="Texture2D" uid="uid://cugtxcfuds31r" path="res://art/indoor/Babushka_bg_01.png" id="2_j25a2"]
@ -10,7 +10,6 @@
[ext_resource type="Texture2D" uid="uid://dnlhlf1mx01h5" path="res://art/indoor/vesna_indoor_door.png" id="11_axs81"] [ext_resource type="Texture2D" uid="uid://dnlhlf1mx01h5" 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="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://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="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="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"] [ext_resource type="PackedScene" uid="uid://cgjc4wurbgimy" path="res://prefabs/UI/Inventory/Inventory.tscn" id="24_xwo8y"]
@ -75,7 +74,6 @@ shape = SubResource("RectangleShape2D_2spkc")
[node name="BackWall" type="Node" parent="."] [node name="BackWall" type="Node" parent="."]
[node name="Room01Walls2" type="Sprite2D" parent="BackWall"] [node name="Room01Walls2" type="Sprite2D" parent="BackWall"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -100 z_index = -100
position = Vector2(4992, -487) position = Vector2(4992, -487)
scale = Vector2(2, 2) scale = Vector2(2, 2)
@ -83,7 +81,6 @@ texture = ExtResource("2_j25a2")
offset = Vector2(-2768, 264) offset = Vector2(-2768, 264)
[node name="Room01Shelf" type="Sprite2D" parent="BackWall"] [node name="Room01Shelf" type="Sprite2D" parent="BackWall"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -50 z_index = -50
position = Vector2(-1978, -678) position = Vector2(-1978, -678)
texture = ExtResource("13_11fdt") texture = ExtResource("13_11fdt")
@ -122,7 +119,6 @@ questResource = ExtResource("9_heyef")
toStatus = 2 toStatus = 2
[node name="Bedsprite" type="Sprite2D" parent="BedInteraction"] [node name="Bedsprite" type="Sprite2D" parent="BedInteraction"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -99 z_index = -99
position = Vector2(4925, -967) position = Vector2(4925, -967)
scale = Vector2(2, 2) scale = Vector2(2, 2)
@ -139,7 +135,6 @@ _id = 0
shape = SubResource("CircleShape2D_2spkc") shape = SubResource("CircleShape2D_2spkc")
[node name="Doorsprite" type="Sprite2D" parent="DoorInteraction"] [node name="Doorsprite" type="Sprite2D" parent="DoorInteraction"]
modulate = Color(0.16470589, 0, 0.49803922, 1)
z_index = -99 z_index = -99
position = Vector2(5559, -961) position = Vector2(5559, -961)
scale = Vector2(2, 2) scale = Vector2(2, 2)
@ -154,13 +149,6 @@ _sceneIndexToLoad = 1
[node name="CountDayUp" type="Node" parent="NightStarter"] [node name="CountDayUp" type="Node" parent="NightStarter"]
script = ExtResource("11_heyef") 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="BedInteraction/QuestCompleter" method="Trigger"]
[connection signal="Interacted" from="BedInteraction" to="NightStarter" method="StartNight"] [connection signal="Interacted" from="BedInteraction" to="NightStarter" method="StartNight"]
[connection signal="Interacted" from="BedInteraction" to="NightStarter/CountDayUp" method="IncreaseDayCount"] [connection signal="Interacted" from="BedInteraction" to="NightStarter/CountDayUp" method="IncreaseDayCount"]

@ -77,23 +77,10 @@ custom_minimum_size = Vector2(100, 80)
layout_mode = 2 layout_mode = 2
theme_override_font_sizes/font_size = 36 theme_override_font_sizes/font_size = 36
toggle_mode = true toggle_mode = true
text = "Settings
"
[node name="MarginContainer4" type="MarginContainer" parent="CanvasLayer/TextureRect/VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_top = 10
theme_override_constants/margin_bottom = 10
[node name="Quit" type="Button" parent="CanvasLayer/TextureRect/VBoxContainer/MarginContainer4"]
custom_minimum_size = Vector2(100, 80)
layout_mode = 2
theme_override_font_sizes/font_size = 36
toggle_mode = true
text = "Quit text = "Quit
" "
[connection signal="pressed" from="CanvasLayer/TextureRect/VBoxContainer/MarginContainer/Continue" to="." method="LoadScene"] [connection signal="pressed" from="CanvasLayer/TextureRect/VBoxContainer/MarginContainer/Continue" to="." method="LoadScene"]
[connection signal="pressed" from="CanvasLayer/TextureRect/VBoxContainer/MarginContainer2/New Game" to="." method="LoadScene"] [connection signal="pressed" from="CanvasLayer/TextureRect/VBoxContainer/MarginContainer2/New Game" to="." method="LoadScene"]
[connection signal="pressed" from="CanvasLayer/TextureRect/VBoxContainer/MarginContainer2/New Game" to="CanvasLayer/TextureRect/VBoxContainer/MarginContainer2/New Game" method="Reset"] [connection signal="pressed" from="CanvasLayer/TextureRect/VBoxContainer/MarginContainer2/New Game" to="CanvasLayer/TextureRect/VBoxContainer/MarginContainer2/New Game" method="Reset"]
[connection signal="pressed" from="CanvasLayer/TextureRect/VBoxContainer/MarginContainer4/Quit" to="." method="Quit"] [connection signal="pressed" from="CanvasLayer/TextureRect/VBoxContainer/MarginContainer3/Quit" to="." method="Quit"]

@ -1,10 +1,13 @@
using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Godot; using Godot;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.Common.Inventory; namespace Babushka.scripts.CSharp.Common.Inventory;
// Do not instantiate this resource // Do not instantiate this resource
// But it has to be a resource because Godot // But it has to be a resource because Godot
[GlobalClass] [GlobalClass]
public partial class ItemInstance: Resource public partial class ItemInstance : Resource, IJsonSerializable
{ {
[Export] public required ItemResource blueprint; [Export] public required ItemResource blueprint;
[Export] public int amount = 1; [Export] public int amount = 1;
@ -17,4 +20,18 @@ public partial class ItemInstance: Resource
amount = amount 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,4 +1,6 @@
using Godot; using Babushka.scripts.CSharp.GameEntity.LoadSave;
using Godot;
using Newtonsoft.Json.Linq;
namespace Babushka.scripts.CSharp.Common.Inventory; 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,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,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,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,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,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,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,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,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,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,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,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,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);
}
}

@ -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. // Contrast multiplier in RGB space. 1.0 means no change.
uniform float contrast_mult : hint_range(0.0, 2.0) = 1.0; 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. // Converts an RGB color to HSV.
vec3 rgb2hsv(vec3 c) { vec3 rgb2hsv(vec3 c) {
float cMax = max(max(c.r, c.g), c.b); float cMax = max(max(c.r, c.g), c.b);
@ -65,6 +68,10 @@ vec3 hsv2rgb(vec3 c) {
return rgb + vec3(m); return rgb + vec3(m);
} }
void vertex(){
modulate = COLOR;
}
void fragment() { void fragment() {
// Get the original texture color. // Get the original texture color.
vec4 tex_color = texture(TEXTURE, UV); vec4 tex_color = texture(TEXTURE, UV);
@ -89,4 +96,6 @@ void fragment() {
// Output the final color while preserving the original alpha. // Output the final color while preserving the original alpha.
COLOR = vec4(col, tex_color.a); COLOR = vec4(col, tex_color.a);
//reapply vertex color value to keep modulate changes
COLOR = COLOR * modulate;
} }

@ -2,8 +2,14 @@ shader_type canvas_item;
uniform vec2 tiling_scale = vec2(5.0, 5.0); uniform vec2 tiling_scale = vec2(5.0, 5.0);
uniform sampler2D noise : repeat_enable; uniform sampler2D noise : repeat_enable;
varying vec4 modulate;
void vertex() {
modulate = COLOR;
}
void fragment() { void fragment() {
vec2 uv = vec2(UV.x * tiling_scale.x, UV.y * tiling_scale.y); // Change 10.0 to control tiling scale 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 = texture(TEXTURE, fract(uv));
COLOR = COLOR * modulate;
} }

@ -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 // 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; uniform float offset = 0;
// caching color settings to reapply modulate value
varying vec4 modulate;
float getWind(vec2 vertex, vec2 uv, float time){ float getWind(vec2 vertex, vec2 uv, float time){
float diff = pow(maxStrength - minStrength, 2.0); float diff = pow(maxStrength - minStrength, 2.0);
float strength = clamp(minStrength + diff + sin(time / interval) * diff, minStrength, maxStrength) * strengthScale; float strength = clamp(minStrength + diff + sin(time / interval) * diff, minStrength, maxStrength) * strengthScale;
@ -47,8 +50,13 @@ float noise(vec2 x) {
} }
void vertex() { void vertex() {
modulate = COLOR;
vec4 pos = MODEL_MATRIX * vec4(0.0, 0.0, 0.0, 1.0); 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(VERTEX.x * noise(VERTEX.xy) * offset);
float time = TIME * speed + sin(pos.x * offset) * cos( pos.x * offset) ; float time = TIME * speed + sin(pos.x * offset) * cos( pos.x * offset) ;
VERTEX.x += getWind(VERTEX.xy, UV, time); VERTEX.x += getWind(VERTEX.xy, UV, time);
} }
void fragment() {
COLOR = modulate * COLOR;
}
Loading…
Cancel
Save