Weapons/Base/Effects/MeleeWindupEffect.cs
namespace Opium;

public partial class MeleeWindupEffect : WeaponEffect
{
	[Property] public Angles WindupAngles { get; set; }
	[Property] public Curve WindupCurve { get; set; }

	public MeleeWeapon MeleeWeapon => Weapon as MeleeWeapon;

	Rotation targetRotation = Rotation.Identity;
	public override bool TickEffect()
	{
		var windupDelta = WindupCurve.Evaluate( Delta );
		targetRotation = Rotation.From( WindupAngles.pitch * windupDelta, WindupAngles.yaw * windupDelta, WindupAngles.roll * windupDelta );

		var attack = MeleeWeapon.CurrentAttack;
		if ( !attack.IsValid() ) return true;
		if ( ( attack.State == AttackState.Swinging || attack.State == AttackState.SwingingHeavyAttack ) ) return true;

		Player.CameraRotationOffset *= targetRotation;

		return false;
	}
}