大修改调整

This commit is contained in:
2026-01-11 23:58:02 +08:00
parent ca68084264
commit f7d44f1f8d
72 changed files with 584396 additions and 20533 deletions

View File

@@ -0,0 +1,21 @@
using NBC;
using UnityEngine;
namespace NBF
{
public abstract class PlayerStateBase : FsmBaseState<FPlayer>
{
protected FPlayer Player => _owner;
/// <summary>
/// 检查状态超时
/// </summary>
public void CheckStateTimeout(float time)
{
if (Time.time - EnterTime >= time)
{
Root.Start<PlayerStateIdle>();
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 080f1176c3ac4eefa37f615b22cac7ed
timeCreated: 1768138530

View File

@@ -0,0 +1,20 @@
namespace NBF
{
public class PlayerStateFight : PlayerStateBase
{
public override uint StateId => (uint)PlayerState.Fishing;
protected override void onEnter()
{
}
protected override void onExit()
{
}
protected override uint onUpdate()
{
return States.None;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0720dd0d400641bea639e36f169aafde
timeCreated: 1768138922

View File

@@ -0,0 +1,23 @@
namespace NBF
{
/// <summary>
/// 钓鱼中
/// </summary>
public class PlayerStateFishing : PlayerStateBase
{
public override uint StateId => (uint)PlayerState.Fishing;
protected override void onEnter()
{
}
protected override void onExit()
{
}
protected override uint onUpdate()
{
return States.None;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 6953fd92b2c54c6e846a0363520a9010
timeCreated: 1768138900

View File

@@ -0,0 +1,41 @@
namespace NBF
{
/// <summary>
/// 闲置中
/// </summary>
public class PlayerStateIdle : PlayerStateBase
{
public override uint StateId => (uint)PlayerState.Idle;
private bool _nextState = false;
protected override void onEnter()
{
_nextState = false;
InputManager.OnOp1Action += OnOp1Action;
}
private void OnOp1Action(bool performed)
{
if (!Player.Rod) return;
if (performed)
{
_nextState = true;
}
}
protected override void onExit()
{
InputManager.OnOp1Action -= OnOp1Action;
}
protected override uint onUpdate()
{
if (_nextState)
{
return (uint)PlayerState.Prepare;
}
return States.None;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a6146dcfbaf54972ac75c8115041ed3e
timeCreated: 1768138510

View File

@@ -0,0 +1,74 @@
using UnityEngine;
namespace NBF
{
/// <summary>
/// 准备抛竿中
/// </summary>
public class PlayerStatePrepare : PlayerStateBase
{
public override uint StateId => (uint)PlayerState.Prepare;
public enum Phase
{
/// <summary>
/// 蓄力
/// </summary>
Charged,
/// <summary>
/// 确认蓄力结果
/// </summary>
Confirm,
}
public Phase Stage = Phase.Charged;
public float ChargedProgress;
protected override void onEnter()
{
Stage = Phase.Charged;
Player.ModelAsset.PlayerAnimator.PrepareThrow = true;
Player.ModelAsset.PlayerAnimator.FishingUp = 0;
}
protected override uint onUpdate()
{
if (Stage == Phase.Charged)
{
ThrowPowerCharged();
}
else if (Stage == Phase.Confirm)
{
//确认蓄力结果,
Debug.Log($"确认蓄力结果,ChargedProgress={ChargedProgress}");
Params.Add(ChargedProgress);
return (uint)PlayerState.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
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1301b70435cd44c8ba3cc6085f35a782
timeCreated: 1768138823

View File

@@ -0,0 +1,145 @@
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;
public float ChargedProgress;
protected override void onEnter()
{
_owner.ModelAsset.PlayerAnimator.StartThrow = true;
ChargedProgress = (float)Params.Get(0);
Debug.Log($"PlayerThrow ChargedProgress={ChargedProgress}");
Stage = Phase.Waiting;
// _owner.Gears.Reel?.Unlock();
}
protected override uint onUpdate()
{
CheckStateTimeout(10);
if (Stage == Phase.AnimBegin)
{
AnimBegin();
ThrowPosition();
}
else if (Stage == Phase.ThrowAnim)
{
ThrowAnim();
}
else if (Stage == Phase.Done)
{
return (uint)PlayerState.Fishing;
}
else if (Stage == Phase.ErrorDone)
{
return (uint)PlayerState.Idle;
}
return base.onUpdate();
}
#region
/// <summary>
/// 抛竿动画事件
/// </summary>
public void RodForceThrowStart()
{
// Debug.LogError($"RodForceThrowStart==");
_owner.ModelAsset.PlayerAnimator.PrepareThrow = false;
_owner.ModelAsset.PlayerAnimator.StartThrow = false;
Stage = Phase.AnimBegin;
}
#endregion
#region 线
private void AnimBegin()
{
_owner.ModelAsset.PlayerAnimator.PrepareThrow = false;
_owner.ModelAsset.PlayerAnimator.StartThrow = false;
_owner.ModelAsset.PlayerAnimator.BaitThrown = true;
Stage = Phase.ThrowAnim;
}
#endregion
#region 竿线
private NTask _throwAnim;
private void ThrowPosition()
{
// if (_owner.PlayerAnimatorCtrl.ThrowMode == ThrowModeEnum.Float)
// {
// _owner.Gears.Rod.lineHandler.pinchController?.ReleasePinch();
// _throwAnim = new BobThrowAnim(_owner);
// _throwAnim.Run(DefRunner.Scheduler);
// }
// else
// {
// _throwAnim = new LureThrowAnim(_owner);
// _throwAnim.Run(DefRunner.Scheduler);
// }
}
private void ThrowAnim()
{
if (_throwAnim.IsDone)
{
// if (_throwAnim.Status == NTaskStatus.Success)
// {
// if (_owner.PlayerAnimatorCtrl.ThrowMode == ThrowModeEnum.Spin)
// {
// SetArm();
// }
//
// Stage = Phase.Done;
// Debug.LogError($"抛线后,线长度={_owner.Data.lineLength}");
// }
// else
// {
// Stage = Phase.ErrorDone;
// }
}
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1a0b4bc6f668446cab7baf752da60477
timeCreated: 1768138870