Make basic overworld and teleport to first dungeon floor

This commit is contained in:
2024-09-07 03:31:42 -07:00
parent 98d096303c
commit 3665150342
10 changed files with 141 additions and 102 deletions

36
src/map/Overworld.cs Normal file
View 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
View 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")

View 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)

View 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")

View 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")