fixed da dialogue

This commit is contained in:
2024-09-07 17:05:10 -07:00
parent 872f246a23
commit f223102525
11 changed files with 88 additions and 91 deletions

View File

@@ -1,13 +1,18 @@
[gd_scene load_steps=5 format=3 uid="uid://dvnc26rebk6o0"]
[gd_scene load_steps=7 format=3 uid="uid://dvnc26rebk6o0"]
[ext_resource type="Script" path="res://src/map/dungeon/floors/Overworld.cs" id="1_5hmt3"]
[ext_resource type="Resource" uid="uid://lao0opxww3ib" path="res://src/dialog/Dialogue.dialogue" id="2_k62pf"]
[ext_resource type="PackedScene" uid="uid://c10nhqq8su6pp" path="res://src/items/weapons/models/RareSword.tscn" id="2_ni2nx"]
[ext_resource type="PackedScene" uid="uid://d4l4qutp8x40c" path="res://src/npc/goddess/Goddess.tscn" id="3_4sm8u"]
[ext_resource type="PackedScene" uid="uid://xb02opiwelet" path="res://src/dialog/DialogueTest.tscn" id="4_thkm7"]
[ext_resource type="PackedScene" uid="uid://kt5fg0it26cf" path="res://src/dialog/Dialog.tscn" id="4_thkm7"]
[sub_resource type="BoxShape3D" id="BoxShape3D_46qk4"]
size = Vector3(1.96582, 2.5011, 2.21289)
[node name="Overworld" type="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.63488, -5.13176)
script = ExtResource("1_5hmt3")
Dialogue = ExtResource("2_k62pf")
[node name="CSGBox3D" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.82007, 0.766602, -1.46094)
@@ -29,5 +34,13 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.8356, -2.30799)
transform = Transform3D(1.4, 0, 0, 0, 1.4, 0, 0, 0, 1.4, -8.84798, -2.93175, -3.9493)
[node name="Panel" parent="Goddess" instance=ExtResource("4_thkm7")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0604029, 0.440545, 0.961159)
collision_layer = 2
unique_name_in_owner = true
[node name="NPCBox" type="Area3D" parent="Goddess/Panel"]
unique_name_in_owner = true
collision_layer = 128
collision_mask = 128
[node name="CollisionShape3D" type="CollisionShape3D" parent="Goddess/Panel/NPCBox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.8395, -1.94114, -8.99061)
shape = SubResource("BoxShape3D_46qk4")

View File

@@ -1,5 +1,7 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using DialogueManagerRuntime;
using GameJamDungeon;
using Godot;
[Meta(typeof(IAutoNode))]
@@ -7,8 +9,32 @@ public partial class Overworld : Node3D, IDungeonFloor
{
public override void _Notification(int what) => this.Notify(what);
[Dependency]
public IGameRepo GameRepo => this.DependOn<IGameRepo>();
[Node] public Area3D NPCBox { get; set; } = default!;
[Export] public Resource Dialogue { get; set; }
public void InitializeDungeon()
{
NPCBox.AreaEntered += NPCBox_AreaEntered;
NPCBox.AreaExited += NPCBox_AreaExited;
}
private void NPCBox_AreaExited(Area3D area)
{
GameRepo.IsWithinDialogueSpace = false;
}
private void NPCBox_AreaEntered(Area3D area)
{
GameRepo.IsWithinDialogueSpace = true;
}
public override void _UnhandledInput(InputEvent @event)
{
if (Input.IsActionJustPressed("ui_accept") && GameRepo.IsWithinDialogueSpace)
DialogueManager.ShowDialogueBalloon(Dialogue, "start");
}
}