used DI for forge managers where possible
This commit is contained in:
@@ -3,6 +3,7 @@ using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Gamesmiths.Forge.Abilities;
|
||||
using Gamesmiths.Forge.Core;
|
||||
using Gamesmiths.Forge.Cues;
|
||||
using Gamesmiths.Forge.Effects;
|
||||
using Gamesmiths.Forge.Events;
|
||||
using Gamesmiths.Forge.Godot.Core;
|
||||
@@ -18,7 +19,7 @@ using Movementtests.systems;
|
||||
using Movementtests.tools;
|
||||
using Node = Godot.Node;
|
||||
|
||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_beetle.png"), Meta(typeof(IAutoOn), typeof(IAutoConnect))]
|
||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_beetle.png"), Meta(typeof(IAutoNode))]
|
||||
public partial class Enemy : CharacterBody3D,
|
||||
IDamageable,
|
||||
IHealthable,
|
||||
@@ -31,6 +32,15 @@ public partial class Enemy : CharacterBody3D,
|
||||
IForgeEntity
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
#region Dependencies
|
||||
|
||||
[Dependency]
|
||||
public TagsManager TagsManager => this.DependOn<TagsManager>();
|
||||
[Dependency]
|
||||
public CuesManager CuesManager => this.DependOn<CuesManager>();
|
||||
|
||||
#endregion
|
||||
|
||||
// Signals and events
|
||||
public event Action<IDamageable, DamageRecord> DamageTaken = null!;
|
||||
@@ -109,15 +119,15 @@ public partial class Enemy : CharacterBody3D,
|
||||
private ResourceBar _resourceBar = null!;
|
||||
private ForgeEntity _forgeEntity;
|
||||
|
||||
public override void _Ready()
|
||||
private AbilityHandle? _hitAbilityHandle;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
Initialize();
|
||||
Init();
|
||||
SetupSignals();
|
||||
}
|
||||
|
||||
private AbilityHandle? _hitAbilityHandle;
|
||||
|
||||
public void Initialize()
|
||||
public void Init()
|
||||
{
|
||||
_damageBox = GetNode<Area3D>("DamageBox");
|
||||
_target = GetNode<Node3D>("CTarget");
|
||||
@@ -137,9 +147,12 @@ public partial class Enemy : CharacterBody3D,
|
||||
|
||||
if (HitAbility != null)
|
||||
_hitAbilityHandle = Abilities.GrantAbilityPermanently(HitAbility.GetAbilityData(), 1, LevelComparison.None, this);
|
||||
}
|
||||
|
||||
Events.Subscribe(Tag.RequestTag(ForgeManagers.Instance.TagsManager, "events.combat.hit"),
|
||||
data => {});
|
||||
public void OnResolved()
|
||||
{
|
||||
Events.Subscribe(Tag.RequestTag(TagsManager, "events.combat.hit"),
|
||||
data => {GD.Print("Hit!");});
|
||||
}
|
||||
|
||||
public void SetupSignals()
|
||||
|
||||
Reference in New Issue
Block a user