Files
2026-03-05 18:07:55 +08:00

76 lines
1.7 KiB
C#

using UnityEngine;
namespace NBF
{
/// <summary>
/// 等待抛竿,蓄力中
/// </summary>
public class PlayerWaitThrow : PlayerStateBase
{
public enum Phase
{
/// <summary>
/// 蓄力
/// </summary>
Charged,
/// <summary>
/// 确认蓄力结果
/// </summary>
Confirm,
}
public Phase Stage = Phase.Charged;
public override uint StateId => States.Player.WaitThrow;
public float ChargedProgress;
protected override void onEnter()
{
Stage = Phase.Charged;
_owner.PlayerAnimatorCtrl.PrepareThrow = true;
_owner.PlayerAnimatorCtrl.FishingFinal = 0;
}
protected override uint onUpdate()
{
if (Stage == Phase.Charged)
{
ThrowPowerCharged();
}
else if (Stage == Phase.Confirm)
{
//确认蓄力结果,
Debug.Log($"确认蓄力结果,ChargedProgress={ChargedProgress}");
Params.Add(ChargedProgress);
return States.Player.Throw;
}
return base.onUpdate();
}
#region
private void ThrowPowerCharged()
{
if (ChargedProgress < 1)
{
ChargedProgress += Time.deltaTime;
}
else if (ChargedProgress > 1)
{
ChargedProgress = 1;
}
if (!InputManager.IsOp1)
{
Stage = Phase.Confirm;
}
}
#endregion
}
}