Fix enemy attacks
This commit is contained in:
@@ -139,7 +139,7 @@ namespace GameJamDungeon
|
||||
GlobalPosition = GameRepo.PlayerGlobalPosition.Value;
|
||||
GameRepo.PlayerGlobalPosition.Sync += PlayerGlobalPosition_Sync;
|
||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||
CollisionDetector.AreaEntered += OnEnemyHitBoxEntered;
|
||||
CollisionDetector.BodyEntered += CollisionDetector_BodyEntered;
|
||||
PlayerData.Inventory.AccessoryUnequipped += Inventory_AccessoryUnequipped;
|
||||
}
|
||||
|
||||
@@ -267,9 +267,9 @@ namespace GameJamDungeon
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
}
|
||||
|
||||
private void OnEnemyHitBoxEntered(Area3D area)
|
||||
private void CollisionDetector_BodyEntered(Node3D body)
|
||||
{
|
||||
if (area is IHitbox hitBox)
|
||||
if (body is IHitbox hitBox)
|
||||
{
|
||||
var enemy = hitBox.GetParent<IEnemy>();
|
||||
var isCriticalHit = false;
|
||||
@@ -284,6 +284,7 @@ namespace GameJamDungeon
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void CurrentHP_Sync(int newHealth)
|
||||
{
|
||||
if (newHealth <= 0)
|
||||
|
||||
Reference in New Issue
Block a user