7 minutes
This commit is contained in:
parent
4d3ac1e4fb
commit
50c6e98481
6 changed files with 212 additions and 26 deletions
|
@ -11,7 +11,8 @@ public partial class Boss : CharacterBody2D
|
|||
public enum State
|
||||
{
|
||||
Default,
|
||||
Injured
|
||||
Injured,
|
||||
Killed
|
||||
}
|
||||
|
||||
private AnimatedSprite2D _sprite;
|
||||
|
@ -45,8 +46,10 @@ public partial class Boss : CharacterBody2D
|
|||
_state = State.Default;
|
||||
}
|
||||
break;
|
||||
case State.Killed:
|
||||
break;
|
||||
}
|
||||
if (_currentHp <= 0)
|
||||
if (_state != State.Killed && _currentHp <= 0)
|
||||
{
|
||||
EmitSignal(SignalName.Killed);
|
||||
}
|
||||
|
@ -55,6 +58,9 @@ public partial class Boss : CharacterBody2D
|
|||
|
||||
private void _OnAttack(Node2D body)
|
||||
{
|
||||
if (_state == State.Killed)
|
||||
return;
|
||||
|
||||
if (body is LivingArmor armor)
|
||||
{
|
||||
_currentHp -= 1;
|
||||
|
|
|
@ -82,7 +82,7 @@ public partial class Claw : CharacterBody2D
|
|||
_isPlayerNearBy = false;
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
public void Enable(Node2D body)
|
||||
{
|
||||
GD.Print("Boss enabled");
|
||||
_state = State.Moving;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue