Bullet data overhaul

This commit is contained in:
Marco 2025-02-11 19:00:01 +01:00
commit 76221ca7a6
9 changed files with 57 additions and 26 deletions

View file

@ -8,24 +8,25 @@ public partial class Bullet : Area2D
{
[Export]
public float Speed = 1900f;
[Export]
public float Damage = 1f;
[Export]
public BulletOwner Owner = BulletOwner.None;
public BulletOwner BulletOwner => _bulletInfo?.Owner ?? BulletOwner.None;
public float Damage => _bulletInfo?.Damage ?? 1;
public DamageType DamageType => _bulletInfo?.DamageType ?? DamageType.Neutral;
private Vector2 _direction = Vector2.Right;
private double _elapsedTime = 0f;
private BulletInfo _bulletInfo;
public BulletInfo BulletInfo => _bulletInfo;
public void Initialize(BulletInfo bulletInfo)
{
_bulletInfo = bulletInfo;
Position = bulletInfo.Position;
Owner = bulletInfo.Owner;
//Position = bulletInfo.Position;
}
private void ApplyTimeModifiers()
@ -141,7 +142,7 @@ public partial class Bullet : Area2D
{
//Debug.WriteLine("Collision with destroyable object area");
destructible.Hit(Damage);
destructible.Hit(Damage, DamageType);
QueueFree();
}
@ -154,3 +155,13 @@ public enum BulletOwner
Player,
Enemy
}
public enum DamageType
{
Neutral,
Ballistic,
Fire,
Ice,
Explosive,
Acid
}