Files
GameJamDungeon/Zennysoft.Game.Ma/src/map/dungeon/code/Floor0.cs

41 lines
1.1 KiB
C#

using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Godot;
using System.Collections.Immutable;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode))]
public partial class Floor0 : Node3D, IDungeonFloor
{
public override void _Notification(int what) => this.Notify(what);
[Dependency] protected IGame Game => this.DependOn<IGame>();
[Node] private Area3D Exit { get; set; } = default!;
[Node] private Marker3D PlayerSpawnPoint { get; set; } = default!;
public ImmutableList<IDungeonRoom> Rooms => [];
public bool FloorIsLoaded { get; set; }
public override void _Ready()
{
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 InitializeDungeon() { return; }
public Transform3D GetPlayerSpawnPoint() { return new Transform3D(PlayerSpawnPoint.Basis, new Vector3(PlayerSpawnPoint.GlobalPosition.X, -3, PlayerSpawnPoint.GlobalPosition.Z)); }
}