100 lines
2.7 KiB
C#
100 lines
2.7 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();
|
|
}
|
|
|
|
// IEnumerator ThrowCoroutine(float distance)
|
|
// {
|
|
// float startLength = 0.5f;
|
|
// Debug.Log($"REST LENGTH : {rope.restLength}");
|
|
// do
|
|
// {
|
|
// float a = Vector3.Distance(rodTipTarget.position, attachedBody.transform.position);
|
|
// attachedBody.RBody.AddForce(playerForward.Value, ForceMode.VelocityChange);
|
|
// startLength = Mathf.Max(a, startLength);
|
|
// UnwindLine(attachedBody.RBody.linearVelocity.magnitude * Time.deltaTime);
|
|
// yield return null;
|
|
// }
|
|
// while ((bool)isBailOpen);
|
|
// }
|
|
|
|
#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
|
|
}
|
|
} |