修改鱼线相关逻辑

This commit is contained in:
2026-04-12 21:17:29 +08:00
parent 8fbb21a66c
commit b83dfd47b1
15 changed files with 1446 additions and 1389 deletions

View File

@@ -13,7 +13,8 @@ namespace NBF
public struct ThrowAnimationRequest
{
public LureController Lure;
// public LureController Lure;
public FishingLineNode EndNode;
public Vector3 ThrowOriginPosition;
public Vector3 StartPosition;
public Vector3 Forward;

View File

@@ -22,7 +22,7 @@ namespace NBF
private float _castElapsedTime;
private Vector3 _castStartPos;
private Vector3 _castTargetPos;
private LureController _castingLure;
private FishingLineNode _castingLure;
public bool IsPlaying => _castingLure != null;
@@ -40,18 +40,18 @@ namespace NBF
public void Play(ThrowAnimationRequest request)
{
if (request.Lure == null)
if (request.EndNode == null)
{
return;
}
Stop(snapToTarget: false);
_castingLure = request.Lure;
_castingLure = request.EndNode;
_chargedProgress = Mathf.Clamp01(request.ChargedProgress);
_castElapsedTime = 0f;
var lureBody = request.Lure.RBody;
var lureBody = request.EndNode.body;
_castStartPos = request.StartPosition;
Vector3 forward = GetHorizontalForward(request.Forward);
@@ -81,7 +81,7 @@ namespace NBF
return;
}
var lureBody = _castingLure.RBody;
var lureBody = _castingLure.body;
if (snapToTarget)
{
_castingLure.transform.position = _castTargetPos;

View File

@@ -101,10 +101,10 @@ namespace NBF
var handItemView = Player.HandItem.GetComponent<PlayerItemView>();
if (handItemView != null && handItemView.Rod != null)
{
if (handItemView.Rod.Line.PinchController != null)
{
handItemView.Rod.Line.PinchController.StartPinch(view.Unity.ModelAsset.Pinch);
}
// if (handItemView.Rod.Line.PinchController != null)
// {
// handItemView.Rod.Line.PinchController.StartPinch(view.Unity.ModelAsset.Pinch);
// }
}
}
}
@@ -118,10 +118,10 @@ namespace NBF
var handItemView = Player.HandItem.GetComponent<PlayerItemView>();
if (handItemView != null && handItemView.Rod != null)
{
if (handItemView.Rod.Line.PinchController != null)
{
handItemView.Rod.Line.PinchController.ReleasePinch();
}
// if (handItemView.Rod.Line.PinchController != null)
// {
// handItemView.Rod.Line.PinchController.ReleasePinch();
// }
}
}
}

View File

@@ -61,7 +61,12 @@ namespace NBF
PlayerView.Unity.ModelAsset.PlayerAnimator.StartThrow = false;
var rod = GetRod();
if (rod == null || rod.Line == null || rod.Line.Lure == null)
if (rod == null || rod.Line == null )
{
return;
}
var endNode = rod.Line.GetEndNode();
if (endNode == null)
{
return;
}
@@ -70,9 +75,9 @@ namespace NBF
_throwAnimation.Player = Player;
_throwAnimation?.Play(new ThrowAnimationRequest
{
Lure = rod.Line.Lure,
EndNode = endNode,
ThrowOriginPosition = PlayerView.Unity.transform.position,
StartPosition = rod.Line.Lure.RBody.position,
StartPosition = endNode.body.position,
Forward = PlayerView.Unity.transform.forward,
ChargedProgress = ChargedProgress
});