Files
GameJamDungeon/Zennysoft.Game.Ma/src/map/dungeon/floors/Special Floors/River.cs
2026-05-01 17:43:11 -07:00

38 lines
805 B
C#

using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Godot;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
[Meta(typeof(IAutoNode))]
public partial class River : SpecialFloor
{
public override void _Notification(int what) => this.Notify(what);
[Node] private Area3D Exit { get; set; } = default!;
[Node] private Marker3D PlayerSpawnPoint { get; set; } = default!;
[Dependency] protected IGame Game => this.DependOn<IGame>();
public void OnResolved()
{
Show();
Exit.AreaEntered += Exit_AreaEntered;
FloorIsLoaded = true;
}
private void Exit_AreaEntered(Area3D area)
{
if (area.GetOwner() is IPlayer)
ExitReached();
}
public void ExitReached() => Game.FloorExitReached();
public void OnExitTree()
{
Exit.AreaEntered -= Exit_AreaEntered;
}
}