using UnityEngine; namespace NBF { /// /// 等待抛竿,蓄力中 /// public class PlayerWaitThrow : PlayerStateBase { public enum Phase { /// /// 蓄力 /// Charged, /// /// 确认蓄力结果 /// 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 } }