Bullet overrides

This commit is contained in:
Marco 2025-03-18 14:58:18 +01:00
commit 533912ba02
6 changed files with 121 additions and 18 deletions

View file

@ -36,13 +36,56 @@ public partial class SpiralPattern : AttackPattern
// [ExportGroup("Modifiers")] [Export] private BulletCreationModifier _modifier;
// [ExportGroup("Modifiers")] [Export] private Array<TimeModifier> _timeModifiers;
[ExportCategory("Other")] [Export] public bool _targetPlayer = false;
[ExportCategory("Overrides")]
[Export] public bool OverrideOwner { get; private set; } = false;
[Export] public BulletOwner Owner { get; private set; } = BulletOwner.None;
[Export] public bool OverrideDamageType { get; private set; } = false;
[Export] public DamageType DamageType { get; private set; } = DamageType.Neutral;
[Export] public bool OverrideControllable { get; private set; } = false;
[Export] public bool Controllable { get; private set; } = false;
protected virtual BulletInfo MakeBullet(Vector2 position, Vector2 direction, float angleOffset)
[ExportCategory("Extra Modifiers")]
[Export]
public bool OverrideCreationModifier { get; private set; } = false;
[Export] public BulletCreationModifier Modifier;
[Export] public Array<TimeModifier> TimeModifiers = [];
protected virtual BulletInfo MakeBullet(Vector2 position, int count = 1, float spread = 0f, float rotationOffset = 0f)
{
var bl = BulletResource.MakeBullet(position, bulletCount, angleOffset);
bl.Direction = direction;
var bullet = this.BulletResource.MakeBullet(position, count,
spread, rotationOffset);
return bl;
if (OverrideOwner)
{
bullet.Owner = this.Owner;
}
if (OverrideDamageType)
{
bullet.DamageType = DamageType;
}
if (OverrideControllable)
{
bullet.Controllabe = Controllable;
}
if (OverrideCreationModifier)
{
bullet.Modifier = this.Modifier;
}
if (TimeModifiers.Count != 0)
{
bullet.TimeModifiers.AddRange(TimeModifiers);
}
//var bl = BulletResource.MakeBullet(position, bulletCount, angleOffset);
//bl.Direction = direction;
return bullet;
// return new BulletInfo()
// {
@ -184,8 +227,9 @@ public partial class SpiralPattern : AttackPattern
direction = (GameManager.Instance.PlayerPosition.Value - Parent.GlobalPosition).Normalized();
}
var bullet = pattern.BulletResource.MakeBullet(Parent.GlobalPosition, pattern.bulletCount,
var bullet = pattern.MakeBullet(Parent.GlobalPosition, pattern.bulletCount,
pattern.spread, angleOffset);
bullet.Direction = direction;
//spawner.SpawnBullet(MakeBullet(Boss.GlobalPosition, direction, angleOffset));