Projectile Rotation

This commit is contained in:
Marco 2025-02-13 18:25:55 +01:00
commit 56ac07367b
12 changed files with 188 additions and 27 deletions

View file

@ -5,6 +5,7 @@ using Cirno.Scripts.Components;
using Cirno.Scripts.Resources;
using Godot;
using Godot.Collections;
using Array = System.Array;
namespace Cirno.Scripts.AttackPatterns;
@ -23,7 +24,7 @@ public partial class SpiralPattern : AttackPattern
[Export] private DamageType _damageType = DamageType.Neutral;
[Export] private float _bulletDamage = 1f;
[Export] private BulletCreationModifier _modifier;
[Export] private Array<Resource> _timeModifiers;
[Export] private Array<TimeModifier> _timeModifiers;
[Export] private bool _targetPlayer = false;
@ -50,7 +51,6 @@ public partial class SpiralPattern : AttackPattern
float angleOffset = _rotationOffset + (float)(rotationSpeed * timer);
Vector2 direction = Vector2.Right;
;
if (_targetPlayer && Boss.GameManager.PlayerPosition.HasValue)
{
@ -70,7 +70,11 @@ public partial class SpiralPattern : AttackPattern
BulletScene = BulletScene,
RotationOffset = angleOffset,
Modifier = _modifier,
TimeModifiers = _timeModifiers?.Where(mod => mod is TimeModifier).Cast<TimeModifier>().ToList() ?? new List<TimeModifier>()
TimeModifiers = ((_timeModifiers?.Where(mod => mod != null)) ?? Array.Empty<TimeModifier>()).Select(m => new ModifierWrapper()
{
TimeModifier = m,
Applied = false
}).ToList()
});
// spawner.SpawnSpiralPattern(Boss.GlobalPosition, bulletSpeed, owner, bulletCount, rotationSpeed, timer, spread, BulletScene);