Teleport works, item pickup is broken

This commit is contained in:
2024-09-07 14:00:40 -07:00
parent 4c2731bc7b
commit fbaf698852
28 changed files with 314 additions and 229 deletions

View File

@@ -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<IAppRepo>();
[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<Node3D>(FIRST_DUNGEON_PATH);
GetParent().AddChild(dungeon);
CallDeferred(MethodName.QueueFree);
}
public void OnExit()
{
AppRepo.Dispose();
}
}

View File

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

18
src/map/Teleport.tscn Normal file
View File

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

View File

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

View File

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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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()
{
}
}

View File

@@ -3,7 +3,6 @@ using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using GameJamDungeon;
using Godot;
using System;
public interface IDungeonRoom : INode3D
{

View File

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

View File

@@ -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