mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 01:15:54 +00:00
Redesigned bullet emitters
This commit is contained in:
parent
ed87163b2f
commit
7b24e47739
16 changed files with 306 additions and 28 deletions
17
Scripts/Components/Actors/EmitterActivationStateSprite.cs
Normal file
17
Scripts/Components/Actors/EmitterActivationStateSprite.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class EmitterActivationStateSprite : Sprite2D
|
||||
{
|
||||
public void ChangeState(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
this.Frame = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Frame = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://701a3no2cu45
|
||||
|
|
@ -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