Finishing up basic pathfinding? later down the line will want to implement warping
This commit is contained in:
+6
-3
@@ -2,11 +2,13 @@ using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public partial class PlayerController : TurnController
|
||||
{
|
||||
[Signal]
|
||||
public delegate void DeathEventHandler(PlayerController THIS);
|
||||
public bool _dead = false;
|
||||
public int _health, _healthMax = 100;
|
||||
public EnemyController _enemyController;
|
||||
public PackedScene _commanderScene = GD.Load<PackedScene>("res://Commander.tscn");
|
||||
@@ -22,9 +24,10 @@ public partial class PlayerController : TurnController
|
||||
{
|
||||
_health += DAMAGE;
|
||||
_health = Math.Clamp(_health, 0, _healthMax);
|
||||
GD.Print(_health);
|
||||
if (_health == 0)
|
||||
if (_health == 0 && !_dead)
|
||||
{
|
||||
_dead = !_dead;
|
||||
GD.Print("YOU DIED");
|
||||
EmitSignal(SignalName.Death, this);
|
||||
}
|
||||
}
|
||||
@@ -60,7 +63,7 @@ public partial class PlayerController : TurnController
|
||||
_towers[3].AddChild(newCommander);
|
||||
}
|
||||
|
||||
public override void StartTurn()
|
||||
public override async Task StartTurn()
|
||||
{
|
||||
_towers.ForEach(t => t.StartTurn());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user