mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 21:25:54 +00:00
Simple knockback implementation
This commit is contained in:
parent
0146de8ab5
commit
78fe44e6ec
10 changed files with 96 additions and 8 deletions
|
|
@ -23,6 +23,8 @@ public partial class GenericDamageReceiver : Area2D, IHittable
|
|||
[Signal]
|
||||
public delegate void ShieldHitEventHandler();
|
||||
|
||||
[Signal] public delegate void BulletHitEventHandler(Bullet bullet, Vector2 position, Vector2 direction);
|
||||
|
||||
//[Signal] public delegate void DeathEventHandler();
|
||||
|
||||
private Node2D _parent;
|
||||
|
|
@ -54,6 +56,9 @@ public partial class GenericDamageReceiver : Area2D, IHittable
|
|||
if (BulletGroup is BulletOwner.None)
|
||||
{
|
||||
this.Hit(bullet.Damage, bullet.DamageType);
|
||||
|
||||
EmitSignalBulletHit(bullet, area.GlobalPosition, (this.GlobalPosition - area.GlobalPosition).Normalized());
|
||||
|
||||
bullet.RequestCollisionDestruction();
|
||||
return;
|
||||
}
|
||||
|
|
@ -61,6 +66,9 @@ public partial class GenericDamageReceiver : Area2D, IHittable
|
|||
if (bullet.BulletInfo.Owner == BulletGroup) return;
|
||||
|
||||
this.Hit(bullet.Damage, bullet.DamageType);
|
||||
|
||||
EmitSignalBulletHit(bullet, area.GlobalPosition, (this.GlobalPosition - area.GlobalPosition).Normalized());
|
||||
|
||||
bullet.RequestCollisionDestruction();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue