mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-04 23:55:53 +00:00
Enemy feedback and mapping fixes
This commit is contained in:
parent
251636364b
commit
eb1e8cfcb8
11 changed files with 33 additions and 14 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using Cirno.Scripts.Enums;
|
||||
using Cirno.Scripts.Components.Actors;
|
||||
using Cirno.Scripts.Enums;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Enemy;
|
||||
|
|
@ -10,16 +11,30 @@ public partial class AnimationModule : ModuleBase<EnemyState, CharacterBody2D>
|
|||
[Export] public PlayerAnimationProvider AnimationProvider { get; set; }
|
||||
|
||||
[Export] public EnemyStorageModule StorageModule { get; set; }
|
||||
[Export] public ActorResourceProvider HealthProvider { get; set; }
|
||||
|
||||
public override void EnterState(EnemyState state)
|
||||
{
|
||||
AnimationProvider.SetAnimation(StorageModule.AimingDirection);
|
||||
AnimationProvider.SetAnimation(Vector2.Zero);
|
||||
if (HealthProvider is not null)
|
||||
{
|
||||
HealthProvider.ResourceDecreased += HealthProviderOnResourceDecreased;
|
||||
}
|
||||
}
|
||||
|
||||
private void HealthProviderOnResourceDecreased(float oldValue, float newValue, float maxValue)
|
||||
{
|
||||
AnimationProvider?.Blink();
|
||||
}
|
||||
|
||||
public override void ExitState(EnemyState state)
|
||||
{
|
||||
AnimationProvider.SetAnimation(Vector2.Zero);
|
||||
if (HealthProvider is not null)
|
||||
{
|
||||
HealthProvider.ResourceDecreased -= HealthProviderOnResourceDecreased;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Init(IStateMachine<EnemyState, CharacterBody2D> machine)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue