Make basic overworld and teleport to first dungeon floor
This commit is contained in:
@@ -38,10 +38,17 @@ namespace GameJamDungeon
|
||||
AppLogic.Set(AppRepo);
|
||||
Menu.NewGame += OnNewGame;
|
||||
Menu.Quit += OnQuit;
|
||||
AppRepo.ShowLoadingScreen += AppRepo_ShowLoadingScreen;
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
|
||||
this.Provide();
|
||||
}
|
||||
|
||||
private void AppRepo_ShowLoadingScreen()
|
||||
{
|
||||
AnimationPlayer.Play("wait_and_load");
|
||||
}
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
AppBinding = AppLogic.Bind();
|
||||
@@ -71,7 +78,8 @@ namespace GameJamDungeon
|
||||
|
||||
private void AnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
AppLogic.Input(new AppLogic.Input.LoadGameFinished());
|
||||
Instantiator.SceneTree.Paused = false;
|
||||
//AppLogic.Input(new AppLogic.Input.LoadGameFinished());
|
||||
}
|
||||
|
||||
public void OnNewGame() => AppLogic.Input(new AppLogic.Input.NewGame());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cagfc5ridmteu"]
|
||||
[gd_scene load_steps=7 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"]
|
||||
@@ -40,7 +40,7 @@ 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),
|
||||
"times": PackedFloat32Array(0, 1.93333, 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)]
|
||||
@@ -58,10 +58,27 @@ tracks/1/keys = {
|
||||
"values": [false, true]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bvk81"]
|
||||
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(1.03333, 1.93333, 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")
|
||||
"load": SubResource("Animation_fa8xf"),
|
||||
"wait_and_load": SubResource("Animation_bvk81")
|
||||
}
|
||||
|
||||
[node name="App" type="CanvasLayer"]
|
||||
@@ -82,7 +99,7 @@ transparent_bg = true
|
||||
handle_input_locally = false
|
||||
audio_listener_enable_3d = true
|
||||
size = Vector2i(1920, 1080)
|
||||
render_target_update_mode = 4
|
||||
render_target_update_mode = 0
|
||||
|
||||
[node name="Menu" parent="." instance=ExtResource("2_kvwo1")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace GameJamDungeon
|
||||
|
||||
event Action? MainMenuEntered;
|
||||
|
||||
event Action? ShowLoadingScreen;
|
||||
|
||||
void SkipSplashScreen();
|
||||
|
||||
void OnMainMenuEntered();
|
||||
@@ -21,6 +23,9 @@ namespace GameJamDungeon
|
||||
void OnExitGame();
|
||||
|
||||
void OnGameOver();
|
||||
|
||||
void OnShowLoadingScreen();
|
||||
|
||||
}
|
||||
|
||||
public class AppRepo : IAppRepo
|
||||
@@ -29,6 +34,7 @@ namespace GameJamDungeon
|
||||
public event Action? MainMenuEntered;
|
||||
public event Action? GameEntered;
|
||||
public event Action? GameExited;
|
||||
public event Action? ShowLoadingScreen;
|
||||
|
||||
private bool _disposedValue;
|
||||
|
||||
@@ -42,6 +48,8 @@ namespace GameJamDungeon
|
||||
|
||||
public void OnGameOver() => GameExited?.Invoke();
|
||||
|
||||
public void OnShowLoadingScreen() => ShowLoadingScreen?.Invoke();
|
||||
|
||||
protected void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposedValue)
|
||||
@@ -53,6 +61,7 @@ namespace GameJamDungeon
|
||||
MainMenuEntered = null;
|
||||
GameEntered = null;
|
||||
GameExited = null;
|
||||
ShowLoadingScreen = null;
|
||||
}
|
||||
|
||||
_disposedValue = true;
|
||||
|
||||
@@ -28,6 +28,9 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
[Node] public NavigationRegion3D NavigationRegion { get; set; } = default!;
|
||||
|
||||
public const string SECOND_FLOOR_PATH = "res://src/map/dungeon/floors/SecondFloor.tscn";
|
||||
public const string THIRD_FLOOR_PATH = "res://src/map/dungeon/floors/ThirdFloor.tscn";
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
GameRepo = new GameRepo();
|
||||
|
||||
@@ -1,21 +1,10 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://33ek675mfb5n"]
|
||||
[gd_scene load_steps=7 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="Script" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="5_fqkhg"]
|
||||
[ext_resource type="PackedScene" uid="uid://dhpwwqow1ahrc" path="res://src/map/dungeon/rooms/Room1.tscn" id="6_04w8n"]
|
||||
[ext_resource type="PackedScene" uid="uid://sv0suc4tjk8h" path="res://src/map/Overworld.tscn" id="5_cx613"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="6_owlf4"]
|
||||
[ext_resource type="PackedScene" uid="uid://bn4gslp2gk8ds" path="res://src/map/dungeon/corridor/Corridor.tscn" id="6_swtay"]
|
||||
[ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="7_1ynbc"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_fke5g"]
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_atd5i"]
|
||||
size = Vector2(10, 10)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_s2hwi"]
|
||||
size = Vector3(10, 1, 10)
|
||||
|
||||
[sub_resource type="NavigationMesh" id="NavigationMesh_xligp"]
|
||||
|
||||
@@ -23,25 +12,12 @@ size = Vector3(10, 1, 10)
|
||||
process_mode = 3
|
||||
script = ExtResource("1_ytcii")
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
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, -71.4241, -4.70883, -0.527107)
|
||||
transform = Transform3D(0.0871905, 0, -0.996192, 0, 1, 0, 0.996192, 0, 0.0871905, 0.81955, 0.00648284, -0.527107)
|
||||
MoveSpeed = 8.0
|
||||
Acceleration = 4.0
|
||||
|
||||
[node name="RigidBody3D" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -69.9907, -4.96505, 0)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D"]
|
||||
mesh = SubResource("PlaneMesh_atd5i")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.498463, 0)
|
||||
shape = SubResource("BoxShape3D_s2hwi")
|
||||
|
||||
[node name="MiniMap" parent="." instance=ExtResource("6_owlf4")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
@@ -60,73 +36,4 @@ omni_attenuation = -0.183
|
||||
unique_name_in_owner = true
|
||||
navigation_mesh = SubResource("NavigationMesh_xligp")
|
||||
|
||||
[node name="DungeonGenerator3D" type="Node3D" parent="."]
|
||||
script = ExtResource("5_fqkhg")
|
||||
room_scenes = Array[PackedScene]([ExtResource("6_04w8n"), ExtResource("7_1ynbc")])
|
||||
corridor_room_scene = ExtResource("6_swtay")
|
||||
dungeon_size = Vector3i(10, 1, 10)
|
||||
|
||||
[node name="RoomsContainer" type="Node3D" parent="DungeonGenerator3D"]
|
||||
|
||||
[node name="DungeonRoom3D_0" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("7_1ynbc")]
|
||||
transform = Transform3D(1.19249e-08, 0, -1, 0, 1, 0, 1, 0, 1.19249e-08, -35, 0, -5)
|
||||
|
||||
[node name="DungeonRoom3D_1" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_04w8n")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -35)
|
||||
|
||||
[node name="DungeonRoom3D_2" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_04w8n")]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -5, 0, 5)
|
||||
|
||||
[node name="DungeonRoom3D_3" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("7_1ynbc")]
|
||||
transform = Transform3D(1.19249e-08, 0, -1, 0, 1, 0, 1, 0, 1.19249e-08, -25, 0, -15)
|
||||
|
||||
[node name="Corridor_4" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -35, 0, -35)
|
||||
|
||||
[node name="Corridor_5" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -35, 0, -45)
|
||||
|
||||
[node name="Corridor_6" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, -45)
|
||||
|
||||
[node name="Corridor_7" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, -45)
|
||||
|
||||
[node name="Corridor_8" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, -45)
|
||||
|
||||
[node name="Corridor_9" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -45)
|
||||
|
||||
[node name="Corridor_10" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -45)
|
||||
|
||||
[node name="Corridor_11" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -25)
|
||||
|
||||
[node name="Corridor_12" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -15)
|
||||
|
||||
[node name="Corridor_13" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15, 0, -5)
|
||||
|
||||
[node name="Corridor_14" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -5)
|
||||
|
||||
[node name="Corridor_15" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, 5)
|
||||
|
||||
[node name="Corridor_16" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -35, 0, 25)
|
||||
|
||||
[node name="Corridor_17" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 25)
|
||||
|
||||
[node name="Corridor_18" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25, 0, 15)
|
||||
|
||||
[node name="Corridor_19" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, 5)
|
||||
|
||||
[node name="Corridor_20" parent="DungeonGenerator3D/RoomsContainer" instance=ExtResource("6_swtay")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15, 0, 15)
|
||||
[node name="Overworld" parent="." instance=ExtResource("5_cx613")]
|
||||
|
||||
36
src/map/Overworld.cs
Normal file
36
src/map/Overworld.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using GameJamDungeon;
|
||||
using Godot;
|
||||
|
||||
public interface IOverworld : INode3D;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Overworld : Node3D
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency] public IAppRepo AppRepo => this.DependOn<IAppRepo>();
|
||||
|
||||
public const string FIRST_FLOOR_PATH = "res://src/map/dungeon/floors/FirstFloor.tscn";
|
||||
|
||||
[Node] public Area3D Teleport { get; set; } = default!;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
Teleport.BodyEntered += Teleport_BodyEntered;
|
||||
}
|
||||
|
||||
private async void Teleport_BodyEntered(Node3D area)
|
||||
{
|
||||
// TODO: Prompt player to proceed to next floor or not
|
||||
GetTree().Paused = true;
|
||||
AppRepo.OnShowLoadingScreen();
|
||||
await ToSignal(GetTree().CreateTimer(2f), "timeout");
|
||||
var instantiator = new Instantiator(GetTree());
|
||||
var firstFloor = instantiator.LoadAndInstantiate<Node>(FIRST_FLOOR_PATH);
|
||||
GetParent().AddChild(firstFloor);
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
35
src/map/Overworld.tscn
Normal file
35
src/map/Overworld.tscn
Normal file
@@ -0,0 +1,35 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://sv0suc4tjk8h"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/map/Overworld.cs" id="1_wvnkp"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4myig"]
|
||||
transparency = 1
|
||||
albedo_color = Color(0.101961, 1, 1, 0.545098)
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_hvri2"]
|
||||
height = 5.0
|
||||
radius = 2.0
|
||||
|
||||
[node name="Overworld" type="Node3D"]
|
||||
script = ExtResource("1_wvnkp")
|
||||
|
||||
[node name="CSGBox3D2" type="CSGBox3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 9.40436, 0)
|
||||
use_collision = true
|
||||
flip_faces = true
|
||||
size = Vector3(50, 20, 50)
|
||||
|
||||
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12.6388, 0, 0)
|
||||
flip_faces = true
|
||||
radius = 2.0
|
||||
height = 5.0
|
||||
material = SubResource("StandardMaterial3D_4myig")
|
||||
|
||||
[node name="Teleport" type="Area3D" parent="CSGCylinder3D"]
|
||||
unique_name_in_owner = true
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="CSGCylinder3D/Teleport"]
|
||||
shape = SubResource("CylinderShape3D_hvri2")
|
||||
12
src/map/dungeon/floors/FirstFloor.tscn
Normal file
12
src/map/dungeon/floors/FirstFloor.tscn
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dkde8r4dgftxm"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="1_qnl2f"]
|
||||
[ext_resource type="PackedScene" uid="uid://dhpwwqow1ahrc" path="res://src/map/dungeon/rooms/Room1.tscn" id="2_ncsxh"]
|
||||
[ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="3_hwomd"]
|
||||
[ext_resource type="PackedScene" uid="uid://bn4gslp2gk8ds" path="res://src/map/dungeon/corridor/Corridor.tscn" id="4_os8ha"]
|
||||
|
||||
[node name="FirstFloor" type="Node3D"]
|
||||
script = ExtResource("1_qnl2f")
|
||||
room_scenes = Array[PackedScene]([ExtResource("2_ncsxh"), ExtResource("3_hwomd")])
|
||||
corridor_room_scene = ExtResource("4_os8ha")
|
||||
dungeon_size = Vector3i(10, 1, 10)
|
||||
6
src/map/dungeon/floors/SecondFloor.tscn
Normal file
6
src/map/dungeon/floors/SecondFloor.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://gp50n7sdgic8"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="1_dmj3t"]
|
||||
|
||||
[node name="SecondFloor" type="Node3D"]
|
||||
script = ExtResource("1_dmj3t")
|
||||
6
src/map/dungeon/floors/ThirdFloor.tscn
Normal file
6
src/map/dungeon/floors/ThirdFloor.tscn
Normal file
@@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://3glnn50mftqk"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="1_hi3c5"]
|
||||
|
||||
[node name="ThirdFloor" type="Node3D"]
|
||||
script = ExtResource("1_hi3c5")
|
||||
Reference in New Issue
Block a user