more stuff
This commit is contained in:
22
Damager.cs
Normal file
22
Damager.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using Godot;
|
||||
using NodeWar.scripts.components;
|
||||
|
||||
public partial class Damager : Timer
|
||||
{
|
||||
[Export]
|
||||
public float Damage { get; set; } = 1;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Timeout += OnTimeout;
|
||||
}
|
||||
|
||||
private void OnTimeout()
|
||||
{
|
||||
var healthComponent = GetParent().GetNode<HealthComponent>("HealthComponent");
|
||||
healthComponent?.TakeDamage(Damage);
|
||||
}
|
||||
|
||||
public override void _Process(double delta) { }
|
||||
}
|
||||
Reference in New Issue
Block a user