diff --git a/project.godot b/project.godot index c935452b..76743e76 100644 --- a/project.godot +++ b/project.godot @@ -28,6 +28,10 @@ project/assembly_name="GameJamDungeon" enabled=PackedStringArray("res://addons/SimpleDungeons/plugin.cfg") +[global_group] + +Exit="" + [input] MoveUp={ diff --git a/src/app/App.cs b/src/app/App.cs index 52f6b757..55b12642 100644 --- a/src/app/App.cs +++ b/src/app/App.cs @@ -28,8 +28,6 @@ namespace GameJamDungeon [Node] public ISubViewport GameWindow { get; set; } = default!; - [Node] public IAnimationPlayer AnimationPlayer { get; set; } = default!; - public void Initialize() { Instantiator = new Instantiator(GetTree()); @@ -38,8 +36,6 @@ namespace GameJamDungeon AppLogic.Set(AppRepo); Menu.NewGame += OnNewGame; Menu.Quit += OnQuit; - AppRepo.ShowLoadingScreen += OnShowLoadingScreen; - AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished; this.Provide(); } @@ -51,7 +47,6 @@ namespace GameJamDungeon .Handle((in AppLogic.Output.ShowLoadingScreen _) => { Menu.Hide(); - AnimationPlayer.Play("load"); }) .Handle((in AppLogic.Output.SetupGameScene _) => { @@ -70,19 +65,6 @@ namespace GameJamDungeon AppLogic.Start(); } - private void OnShowLoadingScreen() - { - AnimationPlayer.Play("wait_and_load"); - } - - private void AnimationPlayer_AnimationFinished(StringName animName) - { - if (animName == "wait_and_load") - Instantiator.SceneTree.Paused = false; - else if (animName == "load") - AppLogic.Input(new AppLogic.Input.LoadGameFinished()); - } - public void OnNewGame() => AppLogic.Input(new AppLogic.Input.NewGame()); public void OnQuit() => AppLogic.Input(new AppLogic.Input.QuitGame()); diff --git a/src/app/App.tscn b/src/app/App.tscn index 4f5f71d8..4df39efd 100644 --- a/src/app/App.tscn +++ b/src/app/App.tscn @@ -1,86 +1,8 @@ -[gd_scene load_steps=7 format=3 uid="uid://cagfc5ridmteu"] +[gd_scene load_steps=3 format=3 uid="uid://cagfc5ridmteu"] [ext_resource type="Script" path="res://src/app/App.cs" id="1_rt73h"] [ext_resource type="PackedScene" uid="uid://rfvnddfqufho" path="res://src/menu/Menu.tscn" id="2_kvwo1"] -[sub_resource type="Animation" id="Animation_mbxap"] -length = 0.001 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("LoadScreen:modulate") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 0, -"values": [Color(1, 1, 1, 0)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("SubViewportContainer:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), -"update": 1, -"values": [true] -} - -[sub_resource type="Animation" id="Animation_fa8xf"] -resource_name = "load" -length = 5.0 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("LoadScreen:modulate") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.466667, 4.03333, 5), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1), Color(0, 0, 0, 1), Color(0, 0, 0, 0)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("SubViewportContainer:visible") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0, 4.03333), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [false, true] -} - -[sub_resource type="Animation" id="Animation_r1pq3"] -resource_name = "wait_and_load" -length = 5.0 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("LoadScreen:modulate") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0.966667, 2.03333, 4.03333, 5), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1), Color(0, 0, 0, 1), Color(0, 0, 0, 0)] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_vkd35"] -_data = { -"RESET": SubResource("Animation_mbxap"), -"load": SubResource("Animation_fa8xf"), -"wait_and_load": SubResource("Animation_r1pq3") -} - [node name="App" type="CanvasLayer"] process_mode = 3 script = ExtResource("1_rt73h") @@ -99,22 +21,7 @@ transparent_bg = true handle_input_locally = false audio_listener_enable_3d = true size = Vector2i(1920, 1080) -render_target_update_mode = 0 +render_target_update_mode = 4 [node name="Menu" parent="." instance=ExtResource("2_kvwo1")] unique_name_in_owner = true - -[node name="LoadScreen" type="ColorRect" parent="."] -modulate = Color(1, 1, 1, 0) -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -color = Color(0.235294, 0.235294, 0.784314, 1) - -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -unique_name_in_owner = true -libraries = { -"": SubResource("AnimationLibrary_vkd35") -} diff --git a/src/app/domain/AppRepo.cs b/src/app/domain/AppRepo.cs index 457f9d46..5bddc463 100644 --- a/src/app/domain/AppRepo.cs +++ b/src/app/domain/AppRepo.cs @@ -12,8 +12,6 @@ namespace GameJamDungeon event Action? MainMenuEntered; - event Action? ShowLoadingScreen; - void SkipSplashScreen(); void OnMainMenuEntered(); @@ -23,8 +21,6 @@ namespace GameJamDungeon void OnExitGame(); void OnGameOver(); - - void OnShowLoadingScreen(); } public class AppRepo : IAppRepo @@ -33,7 +29,6 @@ namespace GameJamDungeon public event Action? MainMenuEntered; public event Action? GameEntered; public event Action? GameExited; - public event Action? ShowLoadingScreen; private bool _disposedValue; @@ -47,8 +42,6 @@ namespace GameJamDungeon public void OnGameOver() => GameExited?.Invoke(); - public void OnShowLoadingScreen() => ShowLoadingScreen?.Invoke(); - protected void Dispose(bool disposing) { if (!_disposedValue) @@ -60,7 +53,6 @@ namespace GameJamDungeon MainMenuEntered = null; GameEntered = null; GameExited = null; - ShowLoadingScreen = null; } _disposedValue = true; diff --git a/src/enemy/CollisionDetector.tscn b/src/enemy/CollisionDetector.tscn index 82a1887d..516d1a26 100644 --- a/src/enemy/CollisionDetector.tscn +++ b/src/enemy/CollisionDetector.tscn @@ -5,8 +5,8 @@ [node name="CollisionDetector" type="Area3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.500351, 0) disable_mode = 2 -collision_layer = 16 -collision_mask = 16 +collision_layer = 18 +collision_mask = 18 [node name="CollisionShape3D" type="CollisionShape3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.633259, 0) diff --git a/src/game/Game.cs b/src/game/Game.cs index c68c0486..467b3677 100644 --- a/src/game/Game.cs +++ b/src/game/Game.cs @@ -4,6 +4,8 @@ using Chickensoft.AutoInject; using Chickensoft.GodotNodeInterfaces; using Chickensoft.Introspection; using Godot; +using System.Collections.Generic; +using System.Linq; public interface IGame : IProvide, INode3D; @@ -14,6 +16,8 @@ public partial class Game : Node3D, IGame IGameRepo IProvide.Value() => GameRepo; + public IInstantiator Instantiator { get; set; } = default!; + public IGameLogic GameLogic { get; set; } = default!; public IGameRepo GameRepo { get; set; } = default!; @@ -28,21 +32,57 @@ public partial class Game : Node3D, IGame [Node] public NavigationRegion3D NavigationRegion { get; set; } = default!; + [Node] public Area3D Teleport { get; set; } = default!; + + [Node] public IDungeonFloor Overworld { get; set; } = default!; + + [Node] public IDungeonFloor Floor1 { get; set; } = default!; + + [Node] public IDungeonFloor Floor2 { get; set; } = default!; + + [Node] public IDungeonFloor Floor3 { get; set; } = default!; + + [Node] public AnimationPlayer AnimationPlayer { get; set; } = default!; + + private List Floors; + + private int _currentFloor = -1; + public void Setup() { GameRepo = new GameRepo(); GameLogic = new GameLogic(); GameLogic.Set(GameRepo); GameLogic.Set(AppRepo); + Instantiator = new Instantiator(GetTree()); + Floors = new List { Overworld, Floor1, Floor2, Floor3 }; + Teleport.BodyEntered += OnTeleportEntered; } + private void OnTeleportEntered(Node3D body) + { + GameLogic.Input(new GameLogic.Input.LoadNextFloor()); + } public void OnResolved() { GameBinding = GameLogic.Bind(); GameBinding - .Handle((in GameLogic.Output.StartGame _) => { }) - .Handle((in GameLogic.Output.SetPauseMode output) => { CallDeferred(nameof(SetPauseMode), output.IsPaused); }) + .Handle((in GameLogic.Output.StartGame _) => + { + }) + .Handle((in GameLogic.Output.LoadNextFloor _) => + { + SetPauseMode(true); + AnimationPlayer.Play("wait_and_load"); + var currentFloor = Floors.ElementAt(_currentFloor); + currentFloor.CallDeferred(MethodName.QueueFree, []); + + }) + .Handle((in GameLogic.Output.SetPauseMode output) => + { + CallDeferred(nameof(SetPauseMode), output.IsPaused); + }) .Handle((in GameLogic.Output.SetInventoryMode _) => { InventoryMenu.PopulateItems(_.Inventory); InventoryMenu.Show(); }) .Handle((in GameLogic.Output.HideInventory _) => { InventoryMenu.Hide(); InventoryMenu.ClearItems(); }) .Handle((in GameLogic.Output.ShowMiniMap _) => { MiniMap.Show(); }) @@ -51,10 +91,31 @@ public partial class Game : Node3D, IGame GameLogic.Start(); GameLogic.Input(new GameLogic.Input.Initialize()); + AnimationPlayer.AnimationStarted += AnimationPlayer_AnimationStarted; + AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished; + + AnimationPlayer.Play("wait_and_load"); this.Provide(); } + private void AnimationPlayer_AnimationStarted(StringName animName) + { + SetPauseMode(true); + + var newFloor = Floors.ElementAt(_currentFloor + 1); + newFloor.CallDeferred(nameof(newFloor.InitializeDungeon), []); + newFloor.Show(); + } + + private void AnimationPlayer_AnimationFinished(StringName animName) + { + var spawnPoints = GetTree().GetNodesInGroup("Exit").OfType(); + Teleport.GlobalPosition = spawnPoints.Last().GlobalPosition; + _currentFloor++; + SetPauseMode(false); + } + public override void _Process(double delta) { if (Input.IsActionJustPressed(GameInputs.Inventory)) diff --git a/src/game/Game.tscn b/src/game/Game.tscn index 17837e37..3266168e 100644 --- a/src/game/Game.tscn +++ b/src/game/Game.tscn @@ -1,15 +1,72 @@ -[gd_scene load_steps=8 format=3 uid="uid://33ek675mfb5n"] +[gd_scene load_steps=16 format=3 uid="uid://33ek675mfb5n"] [ext_resource type="Script" path="res://src/game/Game.cs" id="1_ytcii"] [ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"] [ext_resource type="PackedScene" uid="uid://dlj8qdg1c5048" path="res://src/inventory_menu/InventoryMenu.tscn" id="4_wk8gw"] [ext_resource type="PackedScene" uid="uid://dvnc26rebk6o0" path="res://src/map/Overworld.tscn" id="5_4hqe8"] +[ext_resource type="PackedScene" uid="uid://u1e5ae7whhxg" path="res://src/map/dungeon/floors/Floor1.tscn" id="6_75lk5"] [ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="6_owlf4"] +[ext_resource type="PackedScene" uid="uid://b3r0r22kc67bl" path="res://src/map/dungeon/floors/Floor2.tscn" id="7_1sm5s"] +[ext_resource type="PackedScene" uid="uid://b40sstnic41dw" path="res://src/map/dungeon/floors/Floor3.tscn" id="8_87yk1"] +[ext_resource type="PackedScene" uid="uid://c3ek5i43cl0r5" path="res://src/map/Teleport.tscn" id="9_nwu7r"] [sub_resource type="Environment" id="Environment_fke5g"] [sub_resource type="NavigationMesh" id="NavigationMesh_xligp"] +[sub_resource type="Animation" id="Animation_wewlr"] +resource_name = "load" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("LoadScreen:color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(0, 0.486275, 1, 1), Color(0, 0.486275, 1, 0)] +} + +[sub_resource type="Animation" id="Animation_nc1gg"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("LoadScreen:color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 0)] +} + +[sub_resource type="Animation" id="Animation_ovny8"] +resource_name = "wait_and_load" +length = 3.0 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("LoadScreen:color") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 1.96667, 2.96667), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Color(0, 0.486275, 1, 1), Color(0, 0.486275, 1, 1), Color(0, 0.486275, 1, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_opfbx"] +_data = { +"RESET": SubResource("Animation_nc1gg"), +"load": SubResource("Animation_wewlr"), +"wait_and_load": SubResource("Animation_ovny8") +} + [node name="Game" type="Node3D"] process_mode = 3 script = ExtResource("1_ytcii") @@ -19,7 +76,7 @@ environment = SubResource("Environment_fke5g") [node name="Player" parent="." instance=ExtResource("3_kk6ly")] process_mode = 1 -transform = Transform3D(0.0871905, 0, -0.996192, 0, 1, 0, 0.996192, 0, 0.0871905, -5.335, -4.70883, -0.527107) +transform = Transform3D(0.0871905, 0, -0.996192, 0, 1, 0, 0.996192, 0, 0.0871905, -11.0585, -2.7998, -6.0685) MoveSpeed = 8.0 Acceleration = 4.0 @@ -42,4 +99,39 @@ unique_name_in_owner = true navigation_mesh = SubResource("NavigationMesh_xligp") [node name="Overworld" parent="." instance=ExtResource("5_4hqe8")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.510071, -5.13176) +unique_name_in_owner = true +visible = false + +[node name="Floor1" parent="." instance=ExtResource("6_75lk5")] +unique_name_in_owner = true +visible = false + +[node name="Floor2" parent="." instance=ExtResource("7_1sm5s")] +unique_name_in_owner = true +visible = false + +[node name="Floor3" parent="." instance=ExtResource("8_87yk1")] +unique_name_in_owner = true +visible = false + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +unique_name_in_owner = true +libraries = { +"": SubResource("AnimationLibrary_opfbx") +} + +[node name="LoadScreen" type="ColorRect" parent="."] +process_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(1, 1, 1, 0) + +[node name="Teleport" parent="." instance=ExtResource("9_nwu7r")] +unique_name_in_owner = true +process_mode = 3 +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 900, 900, 900) +disable_mode = 2 +collision_layer = 2 diff --git a/src/game/GameLogic.Input.cs b/src/game/GameLogic.Input.cs index 9b248579..44a20438 100644 --- a/src/game/GameLogic.Input.cs +++ b/src/game/GameLogic.Input.cs @@ -15,6 +15,8 @@ public readonly record struct MiniMapButtonReleased; public readonly record struct GameOver; + + public readonly record struct LoadNextFloor; } } } diff --git a/src/game/GameLogic.Output.cs b/src/game/GameLogic.Output.cs index 4d7af89a..5efe6e65 100644 --- a/src/game/GameLogic.Output.cs +++ b/src/game/GameLogic.Output.cs @@ -19,6 +19,8 @@ namespace GameJamDungeon public readonly record struct HideMiniMap(); public readonly record struct GameOver(); + + public readonly record struct LoadNextFloor; } } } diff --git a/src/game/state/states/Playing.cs b/src/game/state/states/Playing.cs index fcc5659d..479f67fb 100644 --- a/src/game/state/states/Playing.cs +++ b/src/game/state/states/Playing.cs @@ -8,7 +8,7 @@ namespace GameJamDungeon public partial record State { [Meta] - public partial record Playing : State, IGet, IGet, IGet + public partial record Playing : State, IGet, IGet, IGet, IGet { public Playing() { @@ -28,6 +28,12 @@ namespace GameJamDungeon { return To(); } + + public Transition On(in Input.LoadNextFloor input) + { + Output(new Output.LoadNextFloor()); + return ToSelf(); + } } } } diff --git a/src/items/accessory/Accessory.tscn b/src/items/accessory/Accessory.tscn index 04124c10..b8a3b356 100644 --- a/src/items/accessory/Accessory.tscn +++ b/src/items/accessory/Accessory.tscn @@ -11,7 +11,6 @@ Description = "" [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_uavx4"] radius = 0.470016 -height = 0.940032 [node name="Accessory" type="Node3D"] script = ExtResource("1_jq0hu") diff --git a/src/items/armor/Armor.tscn b/src/items/armor/Armor.tscn index 4aa3a6d9..99ba2251 100644 --- a/src/items/armor/Armor.tscn +++ b/src/items/armor/Armor.tscn @@ -4,9 +4,8 @@ [ext_resource type="Texture2D" uid="uid://cgoubcl86pib4" path="res://src/items/armor/armor.png" id="1_vpnem"] [ext_resource type="Resource" uid="uid://chjmkb3aiomvr" path="res://src/items/armor/resources/PatheticCoat.tres" id="2_eftit"] -[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1gpxo"] -radius = 0.470016 -height = 0.940032 +[sub_resource type="BoxShape3D" id="BoxShape3D_qdeu2"] +size = Vector3(0.778381, 0.929947, 0.731567) [node name="Armor" type="Node3D"] script = ExtResource("1_cmjpq") @@ -24,4 +23,5 @@ collision_layer = 4 collision_mask = 4 [node name="CollisionShape3D" type="CollisionShape3D" parent="Pickup"] -shape = SubResource("CapsuleShape3D_1gpxo") +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0600509, 0.26725, 0.180481) +shape = SubResource("BoxShape3D_qdeu2") diff --git a/src/items/weapons/models/CommonSword.tscn b/src/items/weapons/models/CommonSword.tscn index a4039233..8ab2780e 100644 --- a/src/items/weapons/models/CommonSword.tscn +++ b/src/items/weapons/models/CommonSword.tscn @@ -6,7 +6,6 @@ [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_j2it8"] radius = 0.470016 -height = 0.940032 [node name="CommonSword" type="Node3D"] script = ExtResource("1_sr3bh") diff --git a/src/items/weapons/models/RareSword.tscn b/src/items/weapons/models/RareSword.tscn index e32d3a52..cfd98f28 100644 --- a/src/items/weapons/models/RareSword.tscn +++ b/src/items/weapons/models/RareSword.tscn @@ -6,7 +6,6 @@ [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_4ic28"] radius = 0.470016 -height = 0.940032 [node name="RareSword" type="Node3D"] script = ExtResource("1_f8v7v") diff --git a/src/items/weapons/models/UncommonSword.tscn b/src/items/weapons/models/UncommonSword.tscn index b4e938ba..30f29f1c 100644 --- a/src/items/weapons/models/UncommonSword.tscn +++ b/src/items/weapons/models/UncommonSword.tscn @@ -6,7 +6,6 @@ [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cbafi"] radius = 0.470016 -height = 0.940032 [node name="UncommonSword" type="Node3D"] script = ExtResource("1_3o4dy") diff --git a/src/map/Overworld.cs b/src/map/Overworld.cs deleted file mode 100644 index fd2ad558..00000000 --- a/src/map/Overworld.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Chickensoft.AutoInject; -using Chickensoft.GodotNodeInterfaces; -using Chickensoft.Introspection; -using GameJamDungeon; -using Godot; -using System; - -public interface IOverworld : INode3D; - -[Meta(typeof(IAutoNode))] -public partial class Overworld : Node3D -{ - public override void _Notification(int what) => this.Notify(what); - - public IInstantiator Instantiator { get; set; } = default!; - - [Dependency] public IAppRepo AppRepo => this.DependOn(); - - [Node] public Area3D Teleport { get; set; } = default!; - - private const string FIRST_DUNGEON_PATH = "res://src/map/dungeon/floors/FirstFloor.tscn"; - - public void Initialize() - { - Instantiator = new Instantiator(GetTree()); - Teleport.BodyEntered += Teleport_BodyEntered; - } - - private async void Teleport_BodyEntered(Node3D body) - { - Instantiator.SceneTree.Paused = true; - AppRepo.OnShowLoadingScreen(); - await ToSignal(GetTree().CreateTimer(2f), "timeout"); - var dungeon = Instantiator.LoadAndInstantiate(FIRST_DUNGEON_PATH); - GetParent().AddChild(dungeon); - CallDeferred(MethodName.QueueFree); - } - - public void OnExit() - { - AppRepo.Dispose(); - } -} diff --git a/src/map/Overworld.tscn b/src/map/Overworld.tscn index 37befcb3..fcc75acb 100644 --- a/src/map/Overworld.tscn +++ b/src/map/Overworld.tscn @@ -1,34 +1,24 @@ -[gd_scene load_steps=5 format=3 uid="uid://dvnc26rebk6o0"] +[gd_scene load_steps=3 format=3 uid="uid://dvnc26rebk6o0"] -[ext_resource type="PackedScene" uid="uid://b6atdgf2e6e2t" path="res://src/items/weapons/models/CommonSword.tscn" id="1_dnrj0"] -[ext_resource type="Script" path="res://src/map/Overworld.cs" id="1_duf4r"] - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_amchs"] -albedo_color = Color(0, 0, 0.211765, 0.164706) - -[sub_resource type="CylinderShape3D" id="CylinderShape3D_cduj5"] +[ext_resource type="Script" path="res://src/map/dungeon/floors/Overworld.cs" id="1_5hmt3"] +[ext_resource type="PackedScene" uid="uid://c10nhqq8su6pp" path="res://src/items/weapons/models/RareSword.tscn" id="2_ni2nx"] [node name="Overworld" type="Node3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.63488, -5.13176) -script = ExtResource("1_duf4r") +script = ExtResource("1_5hmt3") [node name="CSGBox3D" type="CSGBox3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.82007, 0.766602, -1.46094) flip_faces = true size = Vector3(20, 10, 20) -[node name="CSGCylinder3D" type="CSGCylinder3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.15009, 0) -flip_faces = true -material = SubResource("StandardMaterial3D_amchs") - -[node name="Teleport" type="Area3D" parent="CSGCylinder3D"] +[node name="PlayerSpawnPoint" type="Marker3D" parent="."] unique_name_in_owner = true -collision_layer = 2 -collision_mask = 2 +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4, -6) -[node name="CollisionShape3D" type="CollisionShape3D" parent="CSGCylinder3D/Teleport"] -shape = SubResource("CylinderShape3D_cduj5") +[node name="ExitSpawnPoint" type="Marker3D" parent="." groups=["Exit"]] +unique_name_in_owner = true +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.49531, -3.12363, 0) -[node name="CommonSword" parent="." instance=ExtResource("1_dnrj0")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.188, -3.81491) +[node name="RareSword" parent="." instance=ExtResource("2_ni2nx")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.8356, -2.30799) diff --git a/src/map/Teleport.tscn b/src/map/Teleport.tscn new file mode 100644 index 00000000..b43345cc --- /dev/null +++ b/src/map/Teleport.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=3 format=3 uid="uid://c3ek5i43cl0r5"] + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_vtvx6"] +radius = 1.0 + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dc1b0"] +transparency = 1 +albedo_color = Color(0, 1, 0, 0.164706) + +[node name="Teleport" type="Area3D"] +collision_layer = 2 +collision_mask = 2 + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +shape = SubResource("CylinderShape3D_vtvx6") + +[node name="CSGCylinder3D" type="CSGCylinder3D" parent="."] +material = SubResource("StandardMaterial3D_dc1b0") diff --git a/src/map/dungeon/floors/DungeonFloor.cs b/src/map/dungeon/floors/DungeonFloor.cs new file mode 100644 index 00000000..ca1800cc --- /dev/null +++ b/src/map/dungeon/floors/DungeonFloor.cs @@ -0,0 +1,22 @@ +using Chickensoft.AutoInject; +using Chickensoft.GodotNodeInterfaces; +using Chickensoft.Introspection; +using Godot; + +public interface IDungeonFloor : INode3D +{ + void InitializeDungeon(); +} + +[Meta(typeof(IAutoNode))] +public partial class DungeonFloor : Node3D, IDungeonFloor +{ + public override void _Notification(int what) => this.Notify(what); + + [Node] public GodotObject DungeonGenerator { get; set; } = default!; + + public void InitializeDungeon() + { + DungeonGenerator.Call("generate"); + } +} diff --git a/src/map/dungeon/floors/FirstFloor.tscn b/src/map/dungeon/floors/FirstFloor.tscn deleted file mode 100644 index 70b752c4..00000000 --- a/src/map/dungeon/floors/FirstFloor.tscn +++ /dev/null @@ -1,12 +0,0 @@ -[gd_scene load_steps=5 format=3 uid="uid://u1e5ae7whhxg"] - -[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="1_yb2mo"] -[ext_resource type="PackedScene" uid="uid://dhpwwqow1ahrc" path="res://src/map/dungeon/rooms/Room1.tscn" id="2_0kqcj"] -[ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="3_6orvx"] -[ext_resource type="PackedScene" uid="uid://bn4gslp2gk8ds" path="res://src/map/dungeon/corridor/Corridor.tscn" id="4_4tgqj"] - -[node name="FirstFloor" type="Node3D"] -script = ExtResource("1_yb2mo") -room_scenes = Array[PackedScene]([ExtResource("2_0kqcj"), ExtResource("3_6orvx")]) -corridor_room_scene = ExtResource("4_4tgqj") -dungeon_size = Vector3i(10, 1, 10) diff --git a/src/map/dungeon/floors/Floor1.tscn b/src/map/dungeon/floors/Floor1.tscn new file mode 100644 index 00000000..1e07a7ae --- /dev/null +++ b/src/map/dungeon/floors/Floor1.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=6 format=3 uid="uid://u1e5ae7whhxg"] + +[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="1_sr15j"] +[ext_resource type="PackedScene" uid="uid://dhpwwqow1ahrc" path="res://src/map/dungeon/rooms/Room1.tscn" id="2_dvdf4"] +[ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="3_462ob"] +[ext_resource type="PackedScene" uid="uid://bn4gslp2gk8ds" path="res://src/map/dungeon/corridor/Corridor.tscn" id="4_pgrs5"] +[ext_resource type="Script" path="res://src/map/dungeon/floors/DungeonFloor.cs" id="5_bsukb"] + +[node name="Floor1" type="Node3D"] +script = ExtResource("5_bsukb") + +[node name="DungeonGenerator" type="Node3D" parent="."] +unique_name_in_owner = true +script = ExtResource("1_sr15j") +room_scenes = Array[PackedScene]([ExtResource("2_dvdf4"), ExtResource("3_462ob")]) +corridor_room_scene = ExtResource("4_pgrs5") +dungeon_size = Vector3i(10, 1, 10) +generate_on_ready = false diff --git a/src/map/dungeon/floors/Floor2.tscn b/src/map/dungeon/floors/Floor2.tscn new file mode 100644 index 00000000..13a09292 --- /dev/null +++ b/src/map/dungeon/floors/Floor2.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=6 format=3 uid="uid://b3r0r22kc67bl"] + +[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="1_afeds"] +[ext_resource type="PackedScene" uid="uid://dhpwwqow1ahrc" path="res://src/map/dungeon/rooms/Room1.tscn" id="2_dss74"] +[ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="3_5748f"] +[ext_resource type="PackedScene" uid="uid://bn4gslp2gk8ds" path="res://src/map/dungeon/corridor/Corridor.tscn" id="4_mebix"] +[ext_resource type="Script" path="res://src/map/dungeon/floors/DungeonFloor.cs" id="5_ld0kt"] + +[node name="Floor2" type="Node3D"] +script = ExtResource("5_ld0kt") + +[node name="DungeonGenerator" type="Node3D" parent="."] +unique_name_in_owner = true +script = ExtResource("1_afeds") +room_scenes = Array[PackedScene]([ExtResource("2_dss74"), ExtResource("3_5748f")]) +corridor_room_scene = ExtResource("4_mebix") +dungeon_size = Vector3i(10, 1, 10) +generate_on_ready = false diff --git a/src/map/dungeon/floors/Floor3.tscn b/src/map/dungeon/floors/Floor3.tscn new file mode 100644 index 00000000..1ef94aa3 --- /dev/null +++ b/src/map/dungeon/floors/Floor3.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=6 format=3 uid="uid://b40sstnic41dw"] + +[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="1_ou8lo"] +[ext_resource type="PackedScene" uid="uid://dhpwwqow1ahrc" path="res://src/map/dungeon/rooms/Room1.tscn" id="2_8mwqw"] +[ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="3_ap5wj"] +[ext_resource type="PackedScene" uid="uid://bn4gslp2gk8ds" path="res://src/map/dungeon/corridor/Corridor.tscn" id="4_1741m"] +[ext_resource type="Script" path="res://src/map/dungeon/floors/DungeonFloor.cs" id="5_mo2td"] + +[node name="Floor3" type="Node3D"] +script = ExtResource("5_mo2td") + +[node name="DungeonGenerator" type="Node3D" parent="."] +unique_name_in_owner = true +script = ExtResource("1_ou8lo") +room_scenes = Array[PackedScene]([ExtResource("2_8mwqw"), ExtResource("3_ap5wj")]) +corridor_room_scene = ExtResource("4_1741m") +dungeon_size = Vector3i(10, 1, 10) +generate_on_ready = false diff --git a/src/map/dungeon/floors/Overworld.cs b/src/map/dungeon/floors/Overworld.cs new file mode 100644 index 00000000..eed31614 --- /dev/null +++ b/src/map/dungeon/floors/Overworld.cs @@ -0,0 +1,14 @@ +using Chickensoft.AutoInject; +using Chickensoft.Introspection; +using Godot; + +[Meta(typeof(IAutoNode))] +public partial class Overworld : Node3D, IDungeonFloor +{ + public override void _Notification(int what) => this.Notify(what); + + public void InitializeDungeon() + { + + } +} diff --git a/src/map/dungeon/rooms/DungeonRoom.cs b/src/map/dungeon/rooms/DungeonRoom.cs index 3926f4be..c7d21a4c 100644 --- a/src/map/dungeon/rooms/DungeonRoom.cs +++ b/src/map/dungeon/rooms/DungeonRoom.cs @@ -3,7 +3,6 @@ using Chickensoft.GodotNodeInterfaces; using Chickensoft.Introspection; using GameJamDungeon; using Godot; -using System; public interface IDungeonRoom : INode3D { diff --git a/src/map/dungeon/rooms/Room1.tscn b/src/map/dungeon/rooms/Room1.tscn index 7fb4c033..8786286e 100644 --- a/src/map/dungeon/rooms/Room1.tscn +++ b/src/map/dungeon/rooms/Room1.tscn @@ -1,15 +1,11 @@ -[gd_scene load_steps=19 format=3 uid="uid://dhpwwqow1ahrc"] +[gd_scene load_steps=15 format=3 uid="uid://dhpwwqow1ahrc"] [ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_0tfda"] [ext_resource type="Script" path="res://src/map/dungeon/rooms/DungeonRoom.cs" id="1_ti7ur"] [ext_resource type="PackedScene" uid="uid://ckaw6wjmi0fom" path="res://src/map/dungeon/door/Door.tscn" id="2_mdawx"] [ext_resource type="PackedScene" uid="uid://twrj4wixcbu7" path="res://src/items/ItemDatabase.tscn" id="4_2mnb7"] -[ext_resource type="PackedScene" uid="uid://b6atdgf2e6e2t" path="res://src/items/weapons/models/CommonSword.tscn" id="4_chdi8"] [ext_resource type="PackedScene" uid="uid://dbvr8ewajja6a" path="res://src/enemy/EnemyDatabase.tscn" id="5_owpbq"] -[ext_resource type="PackedScene" uid="uid://cbb1fxllrnlyr" path="res://src/items/weapons/models/UncommonSword.tscn" id="5_viqv4"] -[ext_resource type="PackedScene" uid="uid://c10nhqq8su6pp" path="res://src/items/weapons/models/RareSword.tscn" id="6_c8gn4"] [ext_resource type="PackedScene" uid="uid://dorr7v1tkeiy0" path="res://src/items/armor/Armor.tscn" id="7_bm50w"] -[ext_resource type="PackedScene" uid="uid://1bbmod6680c2" path="res://src/items/accessory/Accessory.tscn" id="8_1psf1"] [ext_resource type="PackedScene" uid="uid://d4l4qutp8x40c" path="res://src/npc/goddess/Goddess.tscn" id="10_82rsb"] [sub_resource type="PlaneMesh" id="PlaneMesh_luhnj"] @@ -36,7 +32,7 @@ agent_radius = 0.15 [sub_resource type="BoxShape3D" id="BoxShape3D_4exnc"] size = Vector3(3.00739, 1, 10.7051) -[node name="DungeonRoom3D" type="Node3D"] +[node name="Room1" type="Node3D"] script = ExtResource("1_0tfda") [node name="DungeonRoom" type="Node3D" parent="."] @@ -55,7 +51,7 @@ mesh = SubResource("PlaneMesh_luhnj") unique_name_in_owner = true [node name="ItemSpawn1" type="Marker3D" parent="ItemSpawnPoints"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.54295, -4.15788, -2.92704) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.83448, -4.15788, -2.92704) gizmo_extents = 1.0 [node name="EnemySpawnPoints" type="Node3D" parent="."] @@ -66,8 +62,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.053, -3, 0) [node name="ItemDatabase" parent="." instance=ExtResource("4_2mnb7")] unique_name_in_owner = true -ItemScene = Array[PackedScene]([ExtResource("7_bm50w"), ExtResource("4_chdi8"), ExtResource("5_viqv4"), ExtResource("6_c8gn4"), ExtResource("8_1psf1")]) -DropRate = PackedFloat32Array(0.25, 0.25, 0.25, 0.25, 0.25) +ItemScene = Array[PackedScene]([ExtResource("7_bm50w")]) +DropRate = PackedFloat32Array(1) [node name="EnemyDatabase" parent="." instance=ExtResource("5_owpbq")] unique_name_in_owner = true @@ -105,3 +101,6 @@ shape = SubResource("BoxShape3D_4exnc") [node name="Goddess" parent="." instance=ExtResource("10_82rsb")] transform = Transform3D(1.4, 0, 0, 0, 1.4, 0, 0, 0, 1.4, -3.23054, -3.37962, 2.05892) + +[node name="ExitSpawnLocation" type="Marker3D" parent="." groups=["Exit"]] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.06499, -3.26251, -2.72249) diff --git a/src/map/dungeon/rooms/Room2.tscn b/src/map/dungeon/rooms/Room2.tscn index 30d5bceb..cf22db04 100644 --- a/src/map/dungeon/rooms/Room2.tscn +++ b/src/map/dungeon/rooms/Room2.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=19 format=3 uid="uid://bbwgmqy3evhh2"] +[gd_scene load_steps=18 format=3 uid="uid://bbwgmqy3evhh2"] [ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonRoom3D.gd" id="1_o02dd"] [ext_resource type="Script" path="res://src/map/dungeon/rooms/DungeonRoom.cs" id="2_jrlll"] @@ -7,7 +7,6 @@ [ext_resource type="PackedScene" uid="uid://ckaw6wjmi0fom" path="res://src/map/dungeon/door/Door.tscn" id="4_nh0nj"] [ext_resource type="PackedScene" uid="uid://b6atdgf2e6e2t" path="res://src/items/weapons/models/CommonSword.tscn" id="4_wqpwj"] [ext_resource type="PackedScene" uid="uid://dbvr8ewajja6a" path="res://src/enemy/EnemyDatabase.tscn" id="5_fabiq"] -[ext_resource type="PackedScene" uid="uid://cbb1fxllrnlyr" path="res://src/items/weapons/models/UncommonSword.tscn" id="6_hb3sb"] [ext_resource type="PackedScene" uid="uid://c10nhqq8su6pp" path="res://src/items/weapons/models/RareSword.tscn" id="7_c5lye"] [ext_resource type="PackedScene" uid="uid://1bbmod6680c2" path="res://src/items/accessory/Accessory.tscn" id="8_1fvbo"] @@ -38,7 +37,7 @@ size = Vector3(3, 1, 50) [sub_resource type="BoxShape3D" id="BoxShape3D_q0wqs"] size = Vector3(7, 1, 47) -[node name="DungeonRoom3D" type="Node3D"] +[node name="Room2" type="Node3D"] script = ExtResource("1_o02dd") size_in_voxels = Vector3i(5, 1, 1) @@ -81,8 +80,8 @@ mesh = SubResource("PlaneMesh_j8q3j") [node name="ItemDatabase" parent="." instance=ExtResource("4_c51bx")] unique_name_in_owner = true -ItemScene = Array[PackedScene]([ExtResource("4_2bf0o"), ExtResource("4_wqpwj"), ExtResource("6_hb3sb"), ExtResource("7_c5lye"), ExtResource("8_1fvbo")]) -DropRate = PackedFloat32Array(0.25, 0.25, 0.25, 0.25, 0.25) +ItemScene = Array[PackedScene]([ExtResource("8_1fvbo"), ExtResource("4_2bf0o"), ExtResource("7_c5lye"), ExtResource("4_wqpwj")]) +DropRate = PackedFloat32Array(0.25, 0.25, 0.25, 0.25) [node name="EnemyDatabase" parent="." instance=ExtResource("5_fabiq")] unique_name_in_owner = true diff --git a/src/player/Player.tscn b/src/player/Player.tscn index 63debf0d..bb280b6d 100644 --- a/src/player/Player.tscn +++ b/src/player/Player.tscn @@ -136,10 +136,11 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.937567, 0) shape = SubResource("CapsuleShape3D_dw45s") [node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"] +visible = false mesh = SubResource("CapsuleMesh_dmans") [node name="Camera3D" type="Camera3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.36136, -0.472795) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.36136, 0.0347929) cull_mask = 1048573 [node name="OmniLight3D" type="OmniLight3D" parent="."]