接入新逻辑
# Conflicts: # Assets/Scenes/RopeTest.unity # Assets/Scripts/Fishing/New/View/Player/Tackle/FLine.cs # Assets/Scripts/Fishing/Rope/Rope.cs # Assets/Scripts/Fishing/Rope/Rope.cs.meta
This commit is contained in:
@@ -20,7 +20,7 @@ namespace NBF
|
||||
|
||||
|
||||
public bool isPinched { get; private set; }
|
||||
|
||||
|
||||
private bool moveToTargetDone;
|
||||
private float _speed;
|
||||
|
||||
@@ -44,11 +44,6 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
// SyncPosition();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
SyncPosition();
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace NBF
|
||||
|
||||
public struct ThrowAnimationRequest
|
||||
{
|
||||
public LureController Lure;
|
||||
public FLineLogicNode Lure;
|
||||
public Vector3 ThrowOriginPosition;
|
||||
public Vector3 StartPosition;
|
||||
public Vector3 Forward;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace NBF
|
||||
private float _castElapsedTime;
|
||||
private Vector3 _castStartPos;
|
||||
private Vector3 _castTargetPos;
|
||||
private LureController _castingLure;
|
||||
private FLineLogicNode _castingLure;
|
||||
|
||||
public bool IsPlaying => _castingLure != null;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace NBF
|
||||
_chargedProgress = Mathf.Clamp01(request.ChargedProgress);
|
||||
_castElapsedTime = 0f;
|
||||
|
||||
var lureBody = request.Lure.RBody;
|
||||
var lureBody = request.Lure.Rigidbody;
|
||||
_castStartPos = request.StartPosition;
|
||||
|
||||
Vector3 forward = GetHorizontalForward(request.Forward);
|
||||
@@ -81,7 +81,7 @@ namespace NBF
|
||||
return;
|
||||
}
|
||||
|
||||
var lureBody = _castingLure.RBody;
|
||||
var lureBody = _castingLure.Rigidbody;
|
||||
if (snapToTarget)
|
||||
{
|
||||
_castingLure.transform.position = _castTargetPos;
|
||||
@@ -150,4 +150,4 @@ namespace NBF
|
||||
return position;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,9 +101,11 @@ namespace NBF
|
||||
var handItemView = Player.HandItem.GetComponent<PlayerItemView>();
|
||||
if (handItemView != null && handItemView.Rod != null)
|
||||
{
|
||||
if (handItemView.Rod.Line.PinchController != null)
|
||||
var endNode = handItemView.Rod.Line.GetNode(FLineLogicNodeType.End);
|
||||
var pinch = endNode.gameObject.GetComponent<JointPinchController>();
|
||||
if (pinch != null)
|
||||
{
|
||||
handItemView.Rod.Line.PinchController.StartPinch(view.Unity.ModelAsset.Pinch);
|
||||
pinch.StartPinch(view.Unity.ModelAsset.Pinch);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,9 +120,12 @@ namespace NBF
|
||||
var handItemView = Player.HandItem.GetComponent<PlayerItemView>();
|
||||
if (handItemView != null && handItemView.Rod != null)
|
||||
{
|
||||
if (handItemView.Rod.Line.PinchController != null)
|
||||
var endNode = handItemView.Rod.Line.GetNode(FLineLogicNodeType.End);
|
||||
var pinch = endNode.gameObject.GetComponent<JointPinchController>();
|
||||
if (pinch != null)
|
||||
{
|
||||
handItemView.Rod.Line.PinchController.ReleasePinch();
|
||||
pinch.ReleasePinch();
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,18 +61,19 @@ 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.GetNode(FLineLogicNodeType.End);
|
||||
_throwAnimation = CreateThrowAnimation(rod);
|
||||
_throwAnimation.Player = Player;
|
||||
_throwAnimation?.Play(new ThrowAnimationRequest
|
||||
{
|
||||
Lure = rod.Line.Lure,
|
||||
Lure = endNode,
|
||||
ThrowOriginPosition = PlayerView.Unity.transform.position,
|
||||
StartPosition = rod.Line.Lure.RBody.position,
|
||||
StartPosition = endNode.Rigidbody.position,
|
||||
Forward = PlayerView.Unity.transform.forward,
|
||||
ChargedProgress = ChargedProgress
|
||||
});
|
||||
@@ -108,4 +109,4 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,8 @@ namespace NBF
|
||||
protected override void OnInit()
|
||||
{
|
||||
// transform.position = Rod.lineHandler.LineConnector_1.transform.position;
|
||||
SetParent(Rod.Line.Bobber.transform);
|
||||
var endNode = Rod.Line.GetNode(FLineLogicNodeType.Bobber);
|
||||
SetParent(endNode.transform);
|
||||
transform.localPosition = Vector3.zero;
|
||||
// var buoyancy = GetComponentInParent<CapsuleBuoyancyStable>();
|
||||
// buoyancy.InitBobber();
|
||||
|
||||
@@ -10,18 +10,17 @@ namespace NBF
|
||||
{
|
||||
hookAsset = GetComponent<HookAsset>();
|
||||
}
|
||||
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
|
||||
// transform.position = Rod.lineHandler.LineConnector_2.transform.position;
|
||||
// transform.rotation = Rod.lineHandler.LineConnector_2.transform.rotation; // 确保旋转也同步
|
||||
// SetParent(Rod.lineHandler.LineConnector_2.transform);
|
||||
|
||||
|
||||
SetParent(Rod.Line.Lure.transform);
|
||||
|
||||
var endNode = Rod.Line.GetNode(FLineLogicNodeType.End);
|
||||
SetParent(endNode.transform);
|
||||
transform.localPosition = Vector3.zero;
|
||||
|
||||
|
||||
// var target = lineHandler.LineConnector_2.GetComponent<Rigidbody>();
|
||||
// var joint = Hook.gameObject.GetComponent<ConfigurableJoint>();
|
||||
// joint.connectedBody = target;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0403ffd74ce46fab8bd4ef057e51432
|
||||
timeCreated: 1766582567
|
||||
guid: c7095cf554c345839173044e4786b0ba
|
||||
timeCreated: 1776948821
|
||||
@@ -13,8 +13,8 @@ namespace NBF
|
||||
// LureHookWaterDisplacement = Lure.GetComponent<FWaterDisplacement>();
|
||||
|
||||
// SetParent(Rod.lineHandler.LineConnector_1.transform);
|
||||
|
||||
SetParent(Rod.Line.Lure.transform);
|
||||
var endNode = Rod.Line.GetNode(FLineLogicNodeType.End);
|
||||
SetParent(endNode.transform);
|
||||
transform.localPosition = Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,24 +72,14 @@ namespace NBF
|
||||
if (Line.LineType == LineType.Spinning)
|
||||
{
|
||||
//没有浮漂类型
|
||||
Line.Lure.SetJointDistance(PlayerItem.LineLength);
|
||||
if (PlayerItem.StretchRope)
|
||||
{
|
||||
// Line.SetTargetLength(PlayerItem.Tension > 0f ? 0f : PlayerItem.LineLength);
|
||||
Line.SetTargetLength(PlayerItem.LineLength);
|
||||
}
|
||||
Line.SetLenght(PlayerItem.LineLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
//有浮漂
|
||||
Line.Lure.SetJointDistance(PlayerItem.FloatLength);
|
||||
Line.Bobber.SetJointDistance(PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
if (PlayerItem.StretchRope)
|
||||
{
|
||||
// Line.SetTargetLength(PlayerItem.Tension > 0f ? 0f : PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
Line.SetTargetLength(PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
Line.SetLureLength(PlayerItem.FloatLength);
|
||||
}
|
||||
Line.SetSegmentMaxLength(0, PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
//浮漂位置
|
||||
Line.SetSegmentMaxLength(1, PlayerItem.FloatLength);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,12 +328,12 @@ namespace NBF
|
||||
|
||||
var state = PlayerItem.Owner.State;
|
||||
|
||||
|
||||
Vector3 vector = Line.Lure.transform.position;
|
||||
var endNode = Line.GetNode(FLineLogicNodeType.End);
|
||||
Vector3 vector = endNode.transform.position;
|
||||
|
||||
// 当前物体的朝向与指向 Lure 的方向之间的夹角,在 0(完全对齐)到 1(完全相反)之间的一个比例值
|
||||
float headingAlignment = Vector3.Angle(base.transform.forward,
|
||||
(Line.Lure.transform.position - transform.position).normalized) / 180f;
|
||||
(endNode.transform.position - transform.position).normalized) / 180f;
|
||||
// 经过朝向调制后的有效张力
|
||||
var effectiveTension = Mathf.Clamp(CurrentTension01 * headingAlignment, 0f, 1f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user