mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 08:15:55 +00:00
Generic enemies
This commit is contained in:
parent
762666242e
commit
d99c773641
55 changed files with 968 additions and 204 deletions
|
|
@ -36,6 +36,16 @@ public partial class Shooting : EnemyStateBase
|
|||
|
||||
public float CurrentHealth => DamageReceiver.HealthProvider.CurrentResource;
|
||||
|
||||
public override void Init(IStateMachine<EnemyState, CharacterBody2D> machine)
|
||||
{
|
||||
base.Init(machine);
|
||||
|
||||
if (StorageModule.Root.EnemyResource.BossScript is not null)
|
||||
{
|
||||
this.BossScript = StorageModule.Root.EnemyResource.BossScript;
|
||||
}
|
||||
}
|
||||
|
||||
public override void EnterState()
|
||||
{
|
||||
base.EnterState();
|
||||
|
|
|
|||
16
Scripts/Components/FSM/Enemy/EnemyFSMAnimatedSprite.cs
Normal file
16
Scripts/Components/FSM/Enemy/EnemyFSMAnimatedSprite.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Enemy;
|
||||
|
||||
public partial class EnemyFSMAnimatedSprite : AnimatedSprite2D
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
var enemyFsmProxy = this.GetParentOrNull<EnemyFSMProxy>();
|
||||
|
||||
if (enemyFsmProxy?.EnemyResource?.AnimationFrames != null)
|
||||
{
|
||||
this.SpriteFrames = enemyFsmProxy.EnemyResource.AnimationFrames;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://dathhlufbe6gr
|
||||
|
|
@ -27,6 +27,12 @@ public partial class EnemyFSMProxy : CharacterBody2D, IActivable
|
|||
|
||||
[Signal] public delegate void DeathEventHandler(EnemyFSMProxy enemy);
|
||||
|
||||
public void Init(EnemyResource enemyResource)
|
||||
{
|
||||
this.EnemyResource = enemyResource;
|
||||
|
||||
}
|
||||
|
||||
public void TriggerDeath()
|
||||
{
|
||||
EmitSignalDeath(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue