cirnogodot/Scripts/Resources/DecreasingSpeedModifier.cs

22 lines
650 B
C#
Raw Normal View History

using Cirno.Scripts.Components;
using Godot;
2025-02-05 19:41:49 +01:00
namespace Cirno.Scripts.Resources;
[GlobalClass]
[Tool]
2025-02-13 14:32:24 +01:00
public partial class DecreasingSpeedModifier : BulletCreationModifier, IBulletModifier
2025-02-05 19:41:49 +01:00
{
[Export] private float decreaseRate = 0.1f;
public override BulletInfo ModifyBullet(BulletInfo bullet, int bulletIndex, int totalBullets)
{
bullet.Speed = ModifySpeed(bullet.OriginalBulletResource.BulletSpeed, bulletIndex, totalBullets);
return bullet;
}
public float ModifySpeed(float baseSpeed, int bulletIndex, int totalBullets)
2025-02-05 19:41:49 +01:00
{
return Mathf.Max(0, baseSpeed - (decreaseRate * bulletIndex));
}
}