Boss orbs
This commit is contained in:
28
Levels/Scenes/BossOrbs.cs
Normal file
28
Levels/Scenes/BossOrbs.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Godot;
|
||||
|
||||
public partial class BossOrbs : RigidBody3D
|
||||
{
|
||||
[Signal]
|
||||
public delegate void OnBossOrbExplodedEventHandler();
|
||||
|
||||
[Export]
|
||||
private float _rotationSpeed = Mathf.Pi;
|
||||
[Export]
|
||||
private HealthPoints _hp;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
GetParentNode3D().Rotate(Vector3.Up, _rotationSpeed * (float)delta);
|
||||
}
|
||||
|
||||
public void OnOrbHit(Node3D node)
|
||||
{
|
||||
_hp.TakeDamage(50000);
|
||||
GD.Print(_hp.CurrentHP);
|
||||
if (_hp.CurrentHP <= 0)
|
||||
{
|
||||
EmitSignal(SignalName.OnBossOrbExploded);
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user