45 lines
879 B
C#
45 lines
879 B
C#
using Godot;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
|
|
public partial class Worker : Node2D
|
|
{
|
|
[Signal]
|
|
public delegate void DamageOverflowEventHandler(int OVERFLOW);
|
|
public bool _dead = false, _hovered = false;
|
|
public int _health = 5, _healthMax;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_healthMax = _health;
|
|
}
|
|
|
|
public virtual void ChangeDefense(int CHANGE)
|
|
{
|
|
_health += CHANGE;
|
|
_health = Math.Min(_health, _healthMax);
|
|
if (_health < 0)
|
|
{
|
|
EmitSignal(SignalName.DamageOverflow, _health);
|
|
_health = 0;
|
|
}
|
|
}
|
|
|
|
public void SetSprite(string PATH)
|
|
{
|
|
GetNode<Sprite2D>("Image").Texture = GD.Load<Texture2D>(PATH);
|
|
}
|
|
|
|
// Processes
|
|
// public virtual void ProcessOnCollision(Ball TARGET)
|
|
// {
|
|
// Worker TARGETWORKER = TARGET.GetParent<Worker>();
|
|
// if (_launched)
|
|
// {
|
|
// TARGETWORKER.ChangeDefense(-3);
|
|
// }
|
|
// }
|
|
|
|
}
|