fixed da dialogue
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user