starting to work on enemy attacks and player health
This commit is contained in:
@@ -5,15 +5,30 @@ using System.Linq;
|
||||
|
||||
public partial class PlayerController : TurnController
|
||||
{
|
||||
[Signal]
|
||||
public delegate void DeathEventHandler(PlayerController THIS);
|
||||
public int _health, _healthMax = 100;
|
||||
public EnemyController _enemyController;
|
||||
public PackedScene _commanderScene = GD.Load<PackedScene>("res://Commander.tscn");
|
||||
public List<Tower> _towers = new();
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_health = _healthMax;
|
||||
base._Ready();
|
||||
}
|
||||
|
||||
public void ChangeHealth(int DAMAGE, Node IMPETUS = null)
|
||||
{
|
||||
_health += DAMAGE;
|
||||
_health = Math.Clamp(_health, 0, _healthMax);
|
||||
GD.Print(_health);
|
||||
if (_health == 0)
|
||||
{
|
||||
EmitSignal(SignalName.Death, this);
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckForTurnEnd()
|
||||
{
|
||||
if (_towers.Where(t => t._commander != null).ToList().All(t=>t._commander._actions == 0))
|
||||
|
||||
Reference in New Issue
Block a user