Files
Fishing2/Assets/Scripts/Fishing/Player/States/PlayerStateThrow.cs
2026-01-17 22:46:58 +08:00

85 lines
2.1 KiB
C#

using NBC;
using UnityEngine;
namespace NBF
{
/// <summary>
/// 抛竿中
/// </summary>
public class PlayerStateThrow : PlayerStateBase
{
public override uint StateId => (uint)PlayerState.Throw;
// public enum Phase
// {
// /// <summary>
// /// 等待动画事件回调
// /// </summary>
// Waiting,
//
// /// <summary>
// /// 前摇动画
// /// </summary>
// AnimBegin,
//
// /// <summary>
// /// 抛线动画
// /// </summary>
// ThrowAnim,
//
// /// <summary>
// /// 结束
// /// </summary>
// Done,
// ErrorDone
// }
//
// public Phase Stage = Phase.Waiting;
private bool _nextState = false;
public float ChargedProgress;
protected override void onEnter()
{
Log.Info("enter PlayerStateThrow");
_owner.ModelAsset.PlayerAnimator.StartThrow = true;
ChargedProgress = (float)Params.Get(0);
Debug.Log($"PlayerThrow ChargedProgress={ChargedProgress}");
_nextState = false;
// Stage = Phase.Waiting;
// _owner.Gears.Reel?.Unlock();
}
protected override uint onUpdate()
{
CheckStateTimeout(10);
if (_nextState)
{
return (uint)PlayerState.Fishing;
}
return base.onUpdate();
}
#region
/// <summary>
/// 抛竿动画事件
/// </summary>
public void OnRodThrowStart()
{
Debug.LogError("OnRodThrowStart");
_owner.ModelAsset.PlayerAnimator.PrepareThrow = false;
_owner.ModelAsset.PlayerAnimator.StartThrow = false;
}
public void OnRodThrownEnd()
{
Debug.LogError("OnRodThrownEnd");
_nextState = true;
}
#endregion
}
}