Re-introduce prototype code
This commit is contained in:
44
src/map/dungeon/rooms/DungeonRoom.cs
Normal file
44
src/map/dungeon/rooms/DungeonRoom.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user