Re-introduce prototype code

This commit is contained in:
2024-08-23 00:39:15 -07:00
parent 8b3d1bed8a
commit 2fb0c364ca
62 changed files with 1685 additions and 187 deletions

View File

@@ -0,0 +1,44 @@
using Chickensoft.AutoInject;
using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using GameJamDungeon;
using Godot;
public interface IDungeonRoom : INode3D
{
DungeonRoomLogic DungeonRoomLogic { get; }
public Marker3D PlayerSpawn { get; set; }
}
[Meta(typeof(IAutoNode))]
public partial class DungeonRoom : Node3D, IDungeonRoom, IProvide<DungeonRoomLogic>
{
public override void _Notification(int what) => this.Notify(what);
DungeonRoomLogic IProvide<DungeonRoomLogic>.Value() => DungeonRoomLogic;
[Dependency] public IGameRepo GameRepo => this.DependOn<IGameRepo>();
public DungeonRoomLogic DungeonRoomLogic { get; set; } = default!;
[Node] public Marker3D PlayerSpawn { get; set; } = default!;
public DungeonRoomLogic.IBinding DungeonRoomBinding { get; set; } = default!;
public void Setup()
{
DungeonRoomLogic = new DungeonRoomLogic();
DungeonRoomLogic.Set(this as IDungeonRoom);
DungeonRoomLogic.Set(GameRepo);
}
public void OnResolved()
{
DungeonRoomBinding = DungeonRoomLogic.Bind();
GameRepo.SetPlayerGlobalPosition(PlayerSpawn.GlobalPosition);
DungeonRoomLogic.Start();
this.Provide();
}
}