24 lines
526 B
C#
24 lines
526 B
C#
using Godot;
|
|
|
|
public partial class EnemyBullet : Projectile
|
|
{
|
|
|
|
public override void _PhysicsProcess(double delta)
|
|
{
|
|
TranslateObjectLocal(new Vector3(0, 0, -Speed * (float)delta));
|
|
}
|
|
|
|
public new void OnProjectileHit(Node node)
|
|
{
|
|
SetPhysicsProcess(false);
|
|
|
|
if (node is Character character && character.HasMethod(Character.MethodName.OnHit))
|
|
{
|
|
GD.Print("Player hit: " + character.Name);
|
|
character.Call(Character.MethodName.OnHit, node);
|
|
}
|
|
|
|
QueueFree();
|
|
}
|
|
}
|