44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using Chickensoft.AutoInject;
|
|
using Chickensoft.Introspection;
|
|
using DialogueManagerRuntime;
|
|
using GameJamDungeon;
|
|
using Godot;
|
|
|
|
[Meta(typeof(IAutoNode))]
|
|
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!;
|
|
|
|
[Node] public Marker3D PlayerSpawnPoint { get; set; } = default!;
|
|
|
|
[Export] public Resource Dialogue { get; set; }
|
|
|
|
public void InitializeDungeon()
|
|
{
|
|
NPCBox.AreaEntered += NPCBox_AreaEntered;
|
|
NPCBox.AreaExited += NPCBox_AreaExited;
|
|
GameRepo.SetPlayerGlobalPosition(PlayerSpawnPoint.GlobalPosition);
|
|
}
|
|
|
|
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");
|
|
}
|
|
}
|