mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Enemy spawning
This commit is contained in:
parent
ede8f2028a
commit
29dc9bebe0
20 changed files with 564 additions and 105 deletions
|
|
@ -1,16 +1,20 @@
|
|||
using Godot;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Components.FSM.Enemy._3D;
|
||||
|
||||
public partial class EnemyFSMAnimatedSprite3D : AnimatedSprite3D
|
||||
{
|
||||
[Export] public EnemyProxy3D EnemyProxy { get; private set; }
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
var enemyFsmProxy = this.GetParentOrNull<EnemyProxy3D>();
|
||||
|
||||
if (enemyFsmProxy?.EnemyResource?.AnimationFrames != null)
|
||||
{
|
||||
this.SpriteFrames = enemyFsmProxy.EnemyResource.AnimationFrames;
|
||||
}
|
||||
//EnemyProxy.Initialized += EnemyFsmProxyOnInitialized;
|
||||
this.SpriteFrames = EnemyProxy.EnemyResource.AnimationFrames;
|
||||
}
|
||||
|
||||
private void EnemyFsmProxyOnInitialized(EnemyResource resource)
|
||||
{
|
||||
this.SpriteFrames = resource.AnimationFrames;
|
||||
}
|
||||
}
|
||||
|
|
@ -26,10 +26,13 @@ public partial class EnemyProxy3D : CharacterBody3D, IActivable
|
|||
|
||||
[Signal] public delegate void DeathEventHandler(EnemyProxy3D enemy);
|
||||
|
||||
[Signal]
|
||||
public delegate void InitializedEventHandler(EnemyResource resource);
|
||||
|
||||
public void Init(EnemyResource enemyResource)
|
||||
{
|
||||
this.EnemyResource = enemyResource;
|
||||
|
||||
EmitSignalInitialized(enemyResource);
|
||||
}
|
||||
|
||||
public void TriggerDeath()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue