mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:25:35 +00:00
22 lines
No EOL
650 B
C#
22 lines
No EOL
650 B
C#
using Cirno.Scripts.Components;
|
|
using Godot;
|
|
|
|
namespace Cirno.Scripts.Resources;
|
|
|
|
[GlobalClass]
|
|
[Tool]
|
|
public partial class DecreasingSpeedModifier : BulletCreationModifier, IBulletModifier
|
|
{
|
|
[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)
|
|
{
|
|
return Mathf.Max(0, baseSpeed - (decreaseRate * bulletIndex));
|
|
}
|
|
} |