26 lines
533 B
C#
26 lines
533 B
C#
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
|
|
}
|
|
} |