save
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using Godot;
|
||||
|
||||
public partial class Enemy : PathFollow2D
|
||||
{
|
||||
[Export] public EnemyType Type;
|
||||
[Export] public Health Health;
|
||||
|
||||
public event Action<Enemy> Died;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Health.Death += _ => Died?.Invoke(this);
|
||||
}
|
||||
|
||||
public void ResetEnemy()
|
||||
{
|
||||
GlobalPosition = Vector2.Zero;
|
||||
Rotation = 0f;
|
||||
Visible = true;
|
||||
ProcessMode = ProcessModeEnum.Inherit;
|
||||
|
||||
Health.Reset();
|
||||
// reset velocity, animation, AI, etc here
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user