44 lines
831 B
C#
44 lines
831 B
C#
using Godot;
|
|
|
|
public partial class BossOrb : RigidBody3D
|
|
{
|
|
[Export]
|
|
private HealthPoints _hp;
|
|
|
|
[Signal]
|
|
public delegate void OnBossOrbExplodedEventHandler();
|
|
|
|
[Export]
|
|
private PackedScene _attack;
|
|
|
|
private bool _shouldAttack = false;
|
|
|
|
public void OnOrbHit(Node3D node)
|
|
{
|
|
_hp.TakeDamage(50000);
|
|
GD.Print(_hp.CurrentHP);
|
|
if (_hp.CurrentHP <= 0)
|
|
{
|
|
EmitSignal(SignalName.OnBossOrbExploded);
|
|
QueueFree();
|
|
}
|
|
}
|
|
|
|
public void OnFire(Node3D node)
|
|
{
|
|
if (_shouldAttack)
|
|
{
|
|
var attackZone = GetNode<Area3D>("/root/Level10/AttackZone");
|
|
var attack = _attack.Instantiate<Node3D>();
|
|
attackZone.AddChild(attack);
|
|
}
|
|
|
|
_shouldAttack = !_shouldAttack;
|
|
}
|
|
|
|
public void DestroySelf()
|
|
{
|
|
QueueFree();
|
|
}
|
|
}
|