mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 15:55:54 +00:00
Boss HUD
This commit is contained in:
parent
b4fdb9c9e3
commit
4be64cf7ec
12 changed files with 220 additions and 33 deletions
|
|
@ -51,6 +51,13 @@ public partial class Enemy : CharacterBody2D
|
|||
set => _navigationEnabled = value;
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
[Signal]
|
||||
public delegate void HealthChangedEventHandler(float newValue);
|
||||
|
||||
#endregion
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -220,6 +227,7 @@ public partial class Enemy : CharacterBody2D
|
|||
if (_isDestroyed) return;
|
||||
|
||||
_currentHealth -= damage;
|
||||
EmitSignal(nameof(HealthChanged), _currentHealth);
|
||||
if (!(_currentHealth <= 0)) return;
|
||||
_isDestroyed = true;
|
||||
Explode();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue