Pattern burst rotation

This commit is contained in:
Marco 2025-09-24 16:51:47 +02:00
commit 099c8acf5e
10 changed files with 538 additions and 477 deletions

View file

@ -1,5 +1,6 @@
using Cirno.Scripts.Actors;
using Cirno.Scripts.Components;
using Cirno.Scripts.Enums;
using Cirno.Scripts.Resources;
using Cirno.Scripts.Utils;
using Godot;
@ -11,12 +12,14 @@ namespace Cirno.Scripts.AttackPatterns;
[Tool]
public partial class ShootingPattern3D : AttackPattern
{
[Export] public LoopType LoopType { get; set; }
[Export] public BulletResource BulletResource { get; set; }
[Export] public Vector3 EmitterOffset { get; set; } = Vector3.Zero;
[Export] public int bulletCount = 16;
[Export] public float rotationSpeed = 0f;
[Export] public float BurstRotationSpeed = 0f;
[Export] public bool UseParentRotationOffset { get; set; } = false;
[Export] public float _rotationOffset = 0f;
[Export] public float duration = 5f;
@ -31,13 +34,27 @@ public partial class ShootingPattern3D : AttackPattern
[ExportCategory("Other")] [Export] public bool _predictPlayer = false;
[ExportCategory("Overrides")]
[ExportGroup("Override Damage")]
[Export(PropertyHint.GroupEnable)] public bool OverrideDamage { get; private set; } = false;
[Export] public float DamageOverride { get; private set; } = 10f;
[ExportGroup("Override Speed")]
[Export(PropertyHint.GroupEnable)] public bool OverrideSpeed { get; private set; } = false;
[Export] public float SpeedOverride { get; private set; } = 10f;
[ExportGroup("Override Owner")]
[Export(PropertyHint.GroupEnable)] public bool OverrideOwner { get; private set; } = false;
[Export] public BulletOwner Owner { get; private set; } = BulletOwner.None;
[ExportGroup("Override Damage Type")]
[Export(PropertyHint.GroupEnable)] public bool OverrideDamageType { get; private set; } = false;
[Export] public DamageType DamageType { get; private set; } = DamageType.Neutral;
[ExportGroup("Override Controllable")]
[ExportGroup("Override Attributes")]
[Export(PropertyHint.GroupEnable)] public bool OverrideAttributes { get; private set; } = false;
[Export] public BulletFlags AttributesOverride { get; private set; }
[ExportGroup("Override Controllable (deprecated)")]
[Export(PropertyHint.GroupEnable)] public bool OverrideControllable { get; private set; } = false;
[Export] public bool Controllable { get; private set; } = false;
@ -55,6 +72,16 @@ public partial class ShootingPattern3D : AttackPattern
var bullet = this.BulletResource.MakeBullet(position, count,
spread, rotationOffset);
if (OverrideDamage)
{
bullet.Damage = this.DamageOverride;
}
if (OverrideSpeed)
{
bullet.Speed = this.SpeedOverride;
}
if (OverrideOwner)
{
bullet.Owner = this.Owner;
@ -65,10 +92,15 @@ public partial class ShootingPattern3D : AttackPattern
bullet.DamageType = DamageType;
}
if (OverrideControllable)
if (OverrideAttributes)
{
bullet.Controllabe = Controllable;
bullet.Attributes = AttributesOverride;
}
// if (OverrideControllable)
// {
// bullet.Controllabe = Controllable;
// }
if (OverrideCreationModifier)
{
@ -101,6 +133,8 @@ public partial class ShootingPattern3D : AttackPattern
private int _burstBullets;
private int _currentBurstOffset = 0;
public void Start()
{
ScriptHost = Parent as IScriptHost3D;
@ -147,6 +181,7 @@ public partial class ShootingPattern3D : AttackPattern
if (_burstBullets <= 0)
{
_state = ShootStatus.WaitingReload;
_currentBurstOffset++;
}
else
{
@ -181,7 +216,7 @@ public partial class ShootingPattern3D : AttackPattern
private void Shoot()
{
float angleOffset = pattern._rotationOffset + (float)(pattern.rotationSpeed * timer);
float angleOffset = pattern._rotationOffset + (float)(pattern.rotationSpeed * timer) + (float)(pattern.BurstRotationSpeed * _currentBurstOffset);
Vector2 direction = pattern.BulletResource.Direction;

View file

@ -43,15 +43,25 @@ public partial class SpiralPattern : AttackPattern
[ExportCategory("Other")] [Export] public bool _predictPlayer = false;
[ExportCategory("Overrides")]
[Export] public bool OverrideOwner { get; private set; } = false;
[ExportGroup("Override Damage")]
[Export(PropertyHint.GroupEnable)] public bool OverrideDamage { get; private set; } = false;
[Export] public float DamageOverride { get; private set; } = 10f;
[ExportGroup("Override Owner")]
[Export(PropertyHint.GroupEnable)] public bool OverrideOwner { get; private set; } = false;
[Export] public BulletOwner Owner { get; private set; } = BulletOwner.None;
[Export] public bool OverrideDamageType { get; private set; } = false;
[ExportGroup("Override Damage Type")]
[Export(PropertyHint.GroupEnable)] 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;
[ExportGroup("Override Attributes")]
[Export(PropertyHint.GroupEnable)] public bool OverrideAttributes { get; private set; } = false;
[Export] public BulletFlags AttributesOverride { get; private set; }
[ExportCategory("Extra Modifiers")]
[Export]
[Export(PropertyHint.GroupEnable)]
public bool OverrideCreationModifier { get; private set; } = false;
[Export] public BulletCreationModifier Modifier;
@ -72,9 +82,9 @@ public partial class SpiralPattern : AttackPattern
bullet.DamageType = DamageType;
}
if (OverrideControllable)
if (OverrideAttributes)
{
bullet.Controllabe = Controllable;
bullet.Attributes = AttributesOverride;
}
if (OverrideCreationModifier)