2025-05-09 11:46:58 +02:00
|
|
|
|
using Cirno.Scripts.Components;
|
|
|
|
|
|
using Godot;
|
2025-02-05 19:41:49 +01:00
|
|
|
|
|
|
|
|
|
|
namespace Cirno.Scripts.Resources;
|
|
|
|
|
|
|
|
|
|
|
|
[GlobalClass]
|
2025-04-28 10:52:50 +02:00
|
|
|
|
[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;
|
|
|
|
|
|
|
2025-05-09 11:46:58 +02:00
|
|
|
|
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));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|