Fix collision with player

This commit is contained in:
2023-09-11 00:43:22 -07:00
parent 51307c0d40
commit cb1cad1271
14 changed files with 65 additions and 63 deletions

View File

@@ -10,10 +10,18 @@ public partial class GodCircuit : Node3D
private void OnHit(Node3D node)
{
GD.Print("Hit");
_animationPlayer.Play("OnHit");
var hpComponent = GetNode<HealthPoints>("HP Component");
hpComponent.TakeDamage(800000);
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
if (node is Character character && character.HasMethod(Character.MethodName.OnHit))
{
GD.Print("Player hit: " + character.Name);
character.Call(Character.MethodName.OnHit, node);
}
else
{
GD.Print("Hit");
_animationPlayer.Play("OnHit");
var hpComponent = GetNode<HealthPoints>("HP Component");
hpComponent.TakeDamage(800000);
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
}
}
}