mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 00:05:53 +00:00
Redesigned bullet emitters
This commit is contained in:
parent
ed87163b2f
commit
7b24e47739
16 changed files with 306 additions and 28 deletions
|
|
@ -19,15 +19,23 @@ public partial class GenericDamageReceiver : Area2D, IHittable
|
|||
|
||||
private Node2D _parent;
|
||||
|
||||
public bool Enabled { get; private set; } = true;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_parent = GetParent<Node2D>();
|
||||
HealthProvider.FillResource();
|
||||
HealthProvider.ResourceDepleted += OnDeath;
|
||||
}
|
||||
|
||||
public void ChangeState(bool enabled)
|
||||
{
|
||||
Enabled = enabled;
|
||||
}
|
||||
|
||||
private void _on_damage_hitbox_area_entered(Area2D area)
|
||||
{
|
||||
if (!Enabled) return;
|
||||
if (Invulnerable) return;
|
||||
if (area is not Bullet bullet) return;
|
||||
|
||||
|
|
@ -46,6 +54,7 @@ public partial class GenericDamageReceiver : Area2D, IHittable
|
|||
|
||||
public void Hit(float damage, DamageType damageType = DamageType.Neutral)
|
||||
{
|
||||
if (!Enabled) return;
|
||||
if (Invulnerable) return;
|
||||
|
||||
var dmg = DamageResistances.Aggregate(damage, (current, resistance) => current * resistance.CalculateDamage(current, damageType));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue