Dialogue system; ask user if they want to teleport to next floor
This commit is contained in:
11
src/game/DialogueController.cs
Normal file
11
src/game/DialogueController.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using DialogueManagerRuntime;
|
||||
using Godot;
|
||||
public partial class DialogueController : Node
|
||||
{
|
||||
private DialogueManager DialogueManager;
|
||||
|
||||
[Export] public PackedScene DialogueBalloon { get; set; } = default!;
|
||||
|
||||
[Export] public Resource DialogueResource { get; set; } = default!;
|
||||
}
|
||||
@@ -3,11 +3,15 @@ namespace GameJamDungeon;
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using DialogueManagerRuntime;
|
||||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public interface IGame : IProvide<IGameRepo>, INode3D;
|
||||
public interface IGame : IProvide<IGameRepo>, INode3D
|
||||
{
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class Game : Node3D, IGame
|
||||
@@ -42,6 +46,8 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
[Node] public AnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
[Node] public DialogueController DialogueController { get; set; } = default!;
|
||||
|
||||
private List<IDungeonFloor> Floors;
|
||||
|
||||
private int _currentFloor = -1;
|
||||
@@ -58,8 +64,17 @@ public partial class Game : Node3D, IGame
|
||||
}
|
||||
|
||||
private void OnTeleportEntered(Node3D body)
|
||||
{
|
||||
GameRepo.Pause();
|
||||
DialogueManager.GetCurrentScene = (() => this);
|
||||
DialogueManager.ShowDialogueBalloonScene(DialogueController.DialogueBalloon, DialogueController.DialogueResource, "floor_exit");
|
||||
DialogueManager.DialogueEnded += (Resource resource) => { GameRepo.Resume(); };
|
||||
}
|
||||
|
||||
public void Exit()
|
||||
{
|
||||
GameLogic.Input(new GameLogic.Input.LoadNextFloor());
|
||||
GameRepo.Resume();
|
||||
}
|
||||
|
||||
public void OnResolved()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=15 format=3 uid="uid://33ek675mfb5n"]
|
||||
[gd_scene load_steps=18 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"]
|
||||
@@ -8,7 +8,10 @@
|
||||
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="6_owlf4"]
|
||||
[ext_resource type="PackedScene" path="res://src/map/dungeon/floors/Floor2.tscn" id="7_1sm5s"]
|
||||
[ext_resource type="PackedScene" path="res://src/map/dungeon/floors/Floor3.tscn" id="8_87yk1"]
|
||||
[ext_resource type="PackedScene" path="res://src/map/Teleport.tscn" id="9_nwu7r"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjqgl5u05ia04" path="res://src/map/Teleport.tscn" id="9_nwu7r"]
|
||||
[ext_resource type="Script" path="res://src/game/DialogueController.cs" id="10_58pbt"]
|
||||
[ext_resource type="Resource" uid="uid://6bhfbvi6jbms" path="res://src/ui/dialogue/FloorExit.dialogue" id="11_4ysvf"]
|
||||
[ext_resource type="PackedScene" uid="uid://73jm5qjy52vq" path="res://src/ui/dialogue/Balloon.tscn" id="11_ofwv2"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_fke5g"]
|
||||
|
||||
@@ -123,3 +126,10 @@ 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
|
||||
|
||||
[node name="DialogueController" type="Node" parent="."]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
script = ExtResource("10_58pbt")
|
||||
DialogueBalloon = ExtResource("11_ofwv2")
|
||||
DialogueResource = ExtResource("11_4ysvf")
|
||||
|
||||
Reference in New Issue
Block a user