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;
|
||||
|
|
28
scripts/entities/And.cs
Normal file
28
scripts/entities/And.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class And : Node
|
||||
{
|
||||
[Export] public int CountOfButtons = 2;
|
||||
|
||||
[Signal]
|
||||
public delegate void ConditionMetEventHandler();
|
||||
[Signal]
|
||||
public delegate void ConditionNotMetEventHandler();
|
||||
|
||||
private int _buttons = 0;
|
||||
|
||||
public void Increment()
|
||||
{
|
||||
_buttons++;
|
||||
if (_buttons == CountOfButtons)
|
||||
EmitSignal(SignalName.ConditionNotMet);
|
||||
}
|
||||
|
||||
public void Decrement()
|
||||
{
|
||||
_buttons--;
|
||||
if (_buttons != CountOfButtons)
|
||||
EmitSignal(SignalName.ConditionNotMet);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue