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 Overworld : Node3D, IDungeonFloor { public override void _Notification(int what) => this.Notify(what); [Dependency] protected IGame Game => this.DependOn(); [Node] public Marker3D PlayerSpawnPoint { get; set; } = default!; [Node] private Area3D Exit { get; set; } = default!; [Node] private RescuedItems RescuedItems { get; set; } = default!; public ImmutableList Rooms => []; public bool FloorIsLoaded { get; set; } public void InitializeDungeon() { Show(); Exit.AreaEntered += Exit_AreaEntered; RescuedItems.SpawnRescuedItems(); FloorIsLoaded = true; } private void Exit_AreaEntered(Area3D area) { if (area.GetOwner() is IPlayer) ExitReached(); } public void ExitReached() => Game.FloorExitReached(); public Transform3D GetPlayerSpawnPoint() { return PlayerSpawnPoint.GlobalTransform; } }