Update stuff
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
public partial class BasicEnemy : Node3D
|
||||
{
|
||||
[Export]
|
||||
private HealthPoints _hp;
|
||||
|
||||
protected GameManager _gameManager;
|
||||
|
||||
public override void _Ready()
|
||||
@@ -11,8 +14,13 @@ public partial class BasicEnemy : Node3D
|
||||
|
||||
public void OnEnemyHit(Node3D node)
|
||||
{
|
||||
var currentLevel = (Level)GetTree().GetFirstNodeInGroup("Level");
|
||||
currentLevel.OnEnemyDefeated(this);
|
||||
QueueFree();
|
||||
_hp.TakeDamage(1);
|
||||
|
||||
if (_hp.CurrentHP <= 0)
|
||||
{
|
||||
var currentLevel = (Level)GetTree().GetFirstNodeInGroup("Level");
|
||||
currentLevel.OnEnemyDefeated(this);
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,15 @@ public partial class GodCircuit : Node3D
|
||||
[Export]
|
||||
private AnimationPlayer _animationPlayer;
|
||||
|
||||
[Signal]
|
||||
public delegate void OnEnemyBossHitEventHandler(long damage);
|
||||
|
||||
private void OnHit(Node3D node)
|
||||
{
|
||||
GD.Print("Hit");
|
||||
_animationPlayer.Play("OnHit");
|
||||
var hpComponent = GetNode<HealthPoints>("HP Component");
|
||||
hpComponent.TakeDamage(800000);
|
||||
hpComponent.UpdateHealthbar();
|
||||
if (hpComponent.CurrentHP <= 0)
|
||||
QueueFree();
|
||||
EmitSignal(SignalName.OnEnemyBossHit, hpComponent.CurrentHP);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user