used DI for forge managers where possible
This commit is contained in:
@@ -2,6 +2,9 @@ using Godot;
|
||||
using System;
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Gamesmiths.Forge.Cues;
|
||||
using Gamesmiths.Forge.Godot.Core;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Movementtests.interfaces;using Movementtests.managers;
|
||||
using Movementtests.systems;
|
||||
|
||||
@@ -10,7 +13,7 @@ using Movementtests.systems;
|
||||
typeof(IAutoConnect),
|
||||
typeof(IProvider)
|
||||
)]
|
||||
public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>
|
||||
public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>, IProvide<TagsManager>, IProvide<CuesManager>
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
@@ -34,16 +37,19 @@ public partial class MainSceneTemplate : Node3D, IProvide<InventoryManager>
|
||||
public required InventoryManager InventoryManager { get; set; }
|
||||
InventoryManager IProvide<InventoryManager>.Value() => InventoryManager;
|
||||
|
||||
TagsManager IProvide<TagsManager>.Value() => ForgeManagers.Instance.TagsManager;
|
||||
CuesManager IProvide<CuesManager>.Value() => ForgeManagers.Instance.CuesManager;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
PlayerFellPlane.BodyEntered += StartResetPlayerAnimation;
|
||||
DeathPlane.BodyEntered += KillEnemy;
|
||||
|
||||
|
||||
InventoryManager = new InventoryManager();
|
||||
if (InitialWeaponInventory != null)
|
||||
InventoryManager.InitializeFromResource(InitialWeaponInventory);
|
||||
|
||||
AddChild(InventoryManager);
|
||||
|
||||
this.Provide();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user