Trying teleport again
This commit is contained in:
@@ -38,6 +38,7 @@ namespace GameJamDungeon
|
||||
AppLogic.Set(AppRepo);
|
||||
Menu.NewGame += OnNewGame;
|
||||
Menu.Quit += OnQuit;
|
||||
AppRepo.ShowLoadingScreen += OnShowLoadingScreen;
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
this.Provide();
|
||||
}
|
||||
@@ -69,8 +70,16 @@ 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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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"]
|
||||
@@ -58,10 +58,27 @@ tracks/1/keys = {
|
||||
"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")
|
||||
"load": SubResource("Animation_fa8xf"),
|
||||
"wait_and_load": SubResource("Animation_r1pq3")
|
||||
}
|
||||
|
||||
[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,8 @@ namespace GameJamDungeon
|
||||
void OnExitGame();
|
||||
|
||||
void OnGameOver();
|
||||
|
||||
void OnShowLoadingScreen();
|
||||
}
|
||||
|
||||
public class AppRepo : IAppRepo
|
||||
@@ -29,6 +33,7 @@ namespace GameJamDungeon
|
||||
public event Action? MainMenuEntered;
|
||||
public event Action? GameEntered;
|
||||
public event Action? GameExited;
|
||||
public event Action? ShowLoadingScreen;
|
||||
|
||||
private bool _disposedValue;
|
||||
|
||||
@@ -42,6 +47,8 @@ namespace GameJamDungeon
|
||||
|
||||
public void OnGameOver() => GameExited?.Invoke();
|
||||
|
||||
public void OnShowLoadingScreen() => ShowLoadingScreen?.Invoke();
|
||||
|
||||
protected void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposedValue)
|
||||
@@ -53,6 +60,7 @@ namespace GameJamDungeon
|
||||
MainMenuEntered = null;
|
||||
GameEntered = null;
|
||||
GameExited = null;
|
||||
ShowLoadingScreen = null;
|
||||
}
|
||||
|
||||
_disposedValue = true;
|
||||
|
||||
@@ -1,22 +1,13 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://33ek675mfb5n"]
|
||||
[gd_scene load_steps=8 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://dvnc26rebk6o0" path="res://src/map/Overworld.tscn" id="5_4hqe8"]
|
||||
[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"]
|
||||
|
||||
[node name="Game" type="Node3D"]
|
||||
@@ -28,20 +19,10 @@ 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, -5.335, -4.70883, -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 +41,5 @@ 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_4hqe8")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.510071, -5.13176)
|
||||
|
||||
@@ -132,6 +132,8 @@ public class GameRepo : IGameRepo
|
||||
_inventoryItems.Dispose();
|
||||
_isInventoryScreenOpened.OnCompleted();
|
||||
_isInventoryScreenOpened.Dispose();
|
||||
_isPaused.OnCompleted();
|
||||
_isPaused.Dispose();
|
||||
}
|
||||
|
||||
_disposedValue = true;
|
||||
|
||||
@@ -14,17 +14,13 @@ size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_l64wl")
|
||||
|
||||
[node name="CenterContainer" type="MarginContainer" parent="."]
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 80
|
||||
theme_override_constants/margin_top = 80
|
||||
theme_override_constants/margin_right = 80
|
||||
theme_override_constants/margin_bottom = 80
|
||||
|
||||
[node name="ItemList" type="VBoxContainer" parent="CenterContainer"]
|
||||
unique_name_in_owner = true
|
||||
|
||||
43
src/map/Overworld.cs
Normal file
43
src/map/Overworld.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
34
src/map/Overworld.tscn
Normal file
34
src/map/Overworld.tscn
Normal file
@@ -0,0 +1,34 @@
|
||||
[gd_scene load_steps=5 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"]
|
||||
|
||||
[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")
|
||||
|
||||
[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"]
|
||||
unique_name_in_owner = true
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="CSGCylinder3D/Teleport"]
|
||||
shape = SubResource("CylinderShape3D_cduj5")
|
||||
|
||||
[node name="CommonSword" parent="." instance=ExtResource("1_dnrj0")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.188, -3.81491)
|
||||
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://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)
|
||||
Reference in New Issue
Block a user