using NBC; using UnityEngine; namespace NBF { /// /// 抛竿中 /// public class PlayerStateThrow : PlayerStateBase { public override uint StateId => (uint)PlayerState.Throw; // public enum Phase // { // /// // /// 等待动画事件回调 // /// // Waiting, // // /// // /// 前摇动画 // /// // AnimBegin, // // /// // /// 抛线动画 // /// // ThrowAnim, // // /// // /// 结束 // /// // 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 动画回调 /// /// 抛竿动画事件 /// 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 } }