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

@ -13,7 +13,7 @@ public partial class BulletSpawner : Node2D
public override void _Ready()
{
_gameManager = GetNode<GameManager>("/root/GameScene");
_gameManager = this.GetGameManager();
}
public void SpawnBullet(BulletInfo bulletInfo)
@ -52,7 +52,6 @@ public partial class BulletSpawner : Node2D
//var bullet = BulletScene.Instantiate<Bullet>();
bullet.Position = position;
bullet.Owner = owner;
//bullet.Speed = speed;
float modifiedSpeed = modifier?.ModifySpeed(speed, i, count) ?? speed;
@ -75,13 +74,6 @@ public partial class BulletSpawner : Node2D
Vector2 direction = (target - position).Normalized();
SpawnBullet(position, direction, speed, owner, burstCount, spread: spread, bulletScene: bulletScene, modifier: modifier);
}
[Obsolete]
public void SpawnSpiralPattern(Vector2 position, float speed, BulletOwner owner, int bulletCount, float rotationSpeed, double time, float spread, PackedScene bulletScene = null)
{
float angleOffset = (float)(rotationSpeed * time);
SpawnBullet(position, Vector2.Right, speed, owner, bulletCount, angleOffset, spread, bulletScene: bulletScene);
}
}
public class BulletInfo
@ -91,6 +83,8 @@ public class BulletInfo
public float Speed { get; set; }
public float LifeTime { get; set; }
public BulletOwner Owner { get; set; }
public DamageType DamageType { get; set; }
public float Damage { get; set; }
public int BulletCount { get; set; }
public float RotationSpeed { get; set; }
public float RotationOffset { get; set; }