Rat dialogue

This commit is contained in:
2024-09-09 14:56:22 -07:00
parent 3e0846223e
commit 6e97058905
64 changed files with 136 additions and 1887 deletions

41
src/npc/Npc.cs Normal file
View File

@@ -0,0 +1,41 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using DialogueManagerRuntime;
using GameJamDungeon;
using Godot;
using System.Linq;
[Meta(typeof(IAutoNode))]
public partial class Npc : Node3D
{
public override void _Notification(int what) => this.Notify(what);
[Node] public Area3D DialogueZone { get; set; } = default!;
[Export]
public Godot.Collections.Array<Resource> DialogueOptions { get; set; } = default!;
private bool _isInDialogueZone = false;
public void OnReady()
{
DialogueZone.BodyEntered += DialogueZone_BodyEntered;
DialogueZone.BodyExited += DialogueZone_BodyExited;
}
private void DialogueZone_BodyExited(Node3D body)
{
_isInDialogueZone = false;
}
private void DialogueZone_BodyEntered(Node3D body)
{
_isInDialogueZone = true;
}
public override void _UnhandledInput(InputEvent @event)
{
if (Input.IsActionJustPressed(GameInputs.Throw) && _isInDialogueZone)
DialogueManager.ShowDialogueBalloonScene(DialogueController.DialogueBalloon, DialogueOptions.First(), "introduction");
}
}