39 lines
895 B
C#
39 lines
895 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class Enemy : StaticBody2D
|
|
{
|
|
[Signal]
|
|
public delegate void DeathEventHandler(Enemy THIS);
|
|
public int _damage = 1, _health = 2;
|
|
public Vector2 _speed = Vector2.Up, _range = Vector2.Up;
|
|
public float _movement = 0;
|
|
public GridMarker _gridMarker;
|
|
public Commander _commander;
|
|
public override void _PhysicsProcess(double delta)
|
|
{
|
|
base._PhysicsProcess(delta);
|
|
}
|
|
|
|
public void Attack(Commander COMMANDER)
|
|
{
|
|
COMMANDER.TakeDamage(_damage, this);
|
|
}
|
|
|
|
public void CounterAttack(Commander COMMANDER)
|
|
{
|
|
|
|
}
|
|
|
|
public void TakeDamage(int DAMAGE, Commander ATTACKER)
|
|
{
|
|
GD.Print(_health, _health - DAMAGE);
|
|
_health -= DAMAGE;
|
|
CounterAttack(ATTACKER);
|
|
if (_health <= 0)
|
|
{
|
|
EmitSignal(SignalName.Death, this);
|
|
}
|
|
}
|
|
}
|