diff --git a/Assets/ResRaw/Prefabs/Line/LineHand1.prefab b/Assets/ResRaw/Prefabs/Line/LineHand1.prefab
index 30107b816..7b76a4b20 100644
--- a/Assets/ResRaw/Prefabs/Line/LineHand1.prefab
+++ b/Assets/ResRaw/Prefabs/Line/LineHand1.prefab
@@ -325,6 +325,7 @@ MonoBehaviour:
m_EditorClassIdentifier: Assembly-CSharp::NBF.FLineLogicNode
NodeType: 3
rope: {fileID: 114504105083509877}
+ preRigidbody: {fileID: 54298866000586118}
--- !u!114 &6377942246174119720
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -394,10 +395,6 @@ MonoBehaviour:
- {fileID: 3463242999848273700}
- {fileID: 8491405271793597799}
- {fileID: 2305106969988397276}
- isLureConnect: 0
- rodLine: {fileID: 0}
- fishingRope: {fileID: 114581403422500557}
- bobberRope: {fileID: 114504105083509877}
LinelenghtDiferent: 0
--- !u!1 &1858052053854210
GameObject:
@@ -498,6 +495,7 @@ MonoBehaviour:
m_EditorClassIdentifier: Assembly-CSharp::NBF.FLineLogicNode
NodeType: 1
rope: {fileID: 114581403422500557}
+ preRigidbody: {fileID: 5597807613657979793}
--- !u!1 &1933124697579601
GameObject:
m_ObjectHideFlags: 0
@@ -775,6 +773,7 @@ MonoBehaviour:
m_EditorClassIdentifier: Assembly-CSharp::NBF.FLineLogicNode
NodeType: 1
rope: {fileID: 0}
+ preRigidbody: {fileID: 0}
--- !u!1 &3739175077773299312
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/Scripts/Fishing/New/View/Player/FishingLine/FLine.cs b/Assets/Scripts/Fishing/New/View/Player/FishingLine/FLine.cs
index 518d7eb85..607492817 100644
--- a/Assets/Scripts/Fishing/New/View/Player/FishingLine/FLine.cs
+++ b/Assets/Scripts/Fishing/New/View/Player/FishingLine/FLine.cs
@@ -16,6 +16,15 @@ namespace NBF
SpinningFloat,
}
+ ///
+ /// 线模式
+ ///
+ public enum LineMode
+ {
+ Joint,
+ Constraint
+ }
+
public class FLine : FGearBase
{
public LineType LineType;
@@ -23,18 +32,21 @@ namespace NBF
[Header("连接点配置")] [SerializeField] private Transform anchorTransform;
[SerializeField] private List lineNodes = new List();
- [SerializeField] private bool isLureConnect;
- [SerializeField] private RodLine rodLine;
- ///
- /// 主线
- ///
- [SerializeField] private Rope fishingRope;
+ // [SerializeField] private bool isLureConnect;
+ //
+ // [SerializeField] private RodLine rodLine;
+ //
+ // ///
+ // /// 主线
+ // ///
+ // [SerializeField] private Rope fishingRope;
+ //
+ // ///
+ // /// 浮漂和鱼钩线
+ // ///
+ // [SerializeField] private Rope bobberRope;
- ///
- /// 浮漂和鱼钩线
- ///
- [SerializeField] private Rope bobberRope;
// public LureController Lure;
// public BobberController Bobber;
@@ -51,65 +63,21 @@ namespace NBF
protected override void OnInit()
{
var tipRb = Rod.Asset.LineConnectorRigidbody;
- if (isLureConnect)
- {
- // Lure.SetJoint(tipRb);
- // Lure.EnableCollision(false);
- }
- else
- {
- fishingRope.startAnchor = tipRb;
- // Bobber.SetJoint(tipRb);
- // Lure.SetJoint(Bobber.rbody);
- // Lure.gameObject.SetActive(true);
- // Lure.EnableCollision(false);
- // Lure.SetKinematic(false);
- }
- GetComponentsInChildren(includeInactive: true).ToList().ForEach(delegate(Transform i)
- {
- i.gameObject.SetActive(true);
- });
-
- StartCoroutine(LureUseGravity());
- if (isLureConnect)
- {
- fishingRope.Init(Rod);
- }
- else
- {
- fishingRope.Init(Rod);
- bobberRope.Init(Rod);
- }
+ anchorTransform = tipRb.transform;
+ // StartCoroutine(LureUseGravity());
// rodLine.GenerateLineRendererRope(guides.ToArray(), _LineThickness);
}
- private IEnumerator LureUseGravity()
- {
- yield return 1;
- EndNode.gameObject.SetActive(false);
- EndNode.gameObject.SetActive(true);
- yield return 1;
- EndNode.Rigidbody.useGravity = true;
- }
-
- public void SetTargetLength(float value)
- {
- Log.Error($"SetObiRopeStretch={value}");
- if (value > 3)
- {
- // value -= 0.2f;
- }
-
- fishingRope.SetTargetLength(value);
- }
-
- public void SetLureLength(float value)
- {
- Log.Error($"SetObiRopeStretch={value}");
- bobberRope.SetTargetLength(value);
- }
+ // private IEnumerator LureUseGravity()
+ // {
+ // yield return 1;
+ // EndNode.gameObject.SetActive(false);
+ // EndNode.gameObject.SetActive(true);
+ // yield return 1;
+ // EndNode.Rigidbody.useGravity = true;
+ // }
private void Start()
{
@@ -178,13 +146,15 @@ namespace NBF
#endregion
+
+
#region Tension
private float GetLineDistance()
{
//第一个节点到竿稍的位置-第一段鱼线长度
- return Vector3.Distance(StartNode.transform.position, bobberRope.transform.position) -
- fishingRope.GetCurrentLength();
+ return Vector3.Distance(StartNode.transform.position, BobberNode.transform.position) -
+ BobberNode.Lenght;
}
public float GetTension(float weight)
diff --git a/Assets/Scripts/Fishing/New/View/Player/FishingLine/FLineLogicNode.cs b/Assets/Scripts/Fishing/New/View/Player/FishingLine/FLineLogicNode.cs
index 218dbd24d..9ea1606a8 100644
--- a/Assets/Scripts/Fishing/New/View/Player/FishingLine/FLineLogicNode.cs
+++ b/Assets/Scripts/Fishing/New/View/Player/FishingLine/FLineLogicNode.cs
@@ -15,6 +15,7 @@ namespace NBF
{
[Header("节点设置")] public FLineLogicNodeType NodeType = FLineLogicNodeType.Bobber;
[SerializeField] private Rope rope;
+ [SerializeField] private Rigidbody preRigidbody;
private Rigidbody _rb;
private SpringJoint _joint;
@@ -44,6 +45,27 @@ namespace NBF
{
_joint.maxDistance = lenght;
}
+
+ if (rope)
+ {
+ rope.SetTargetLength(lenght);
+ }
+ }
+
+ ///
+ /// 切换约束模式
+ ///
+ ///
+ public void ChangeMode(LineMode mode)
+ {
+ if (mode == LineMode.Joint)
+ {
+ if (_joint) _joint.connectedBody = preRigidbody;
+ }
+ else if (mode == LineMode.Constraint)
+ {
+ if (_joint) _joint.connectedBody = null;
+ }
}
}
}
\ No newline at end of file
diff --git a/Assets/Scripts/Fishing/Rope/Rope.cs b/Assets/Scripts/Fishing/Rope/Rope.cs
index 03a9cf3a8..214944abc 100644
--- a/Assets/Scripts/Fishing/Rope/Rope.cs
+++ b/Assets/Scripts/Fishing/Rope/Rope.cs
@@ -172,14 +172,7 @@ public class Rope : MonoBehaviour
private bool _isCulledByVisibility;
private int _tIdleSubdiv = -1;
private int _tMovingSubdiv = -1;
-
- private FRod _rod;
- public void Init(FRod rod)
- {
- _rod = rod;
- if (Application.isPlaying)
- RefreshVisibilityState(true);
- }
+
// Catmull t caches(只缓存 idle/moving 两档,减少每帧重复乘法)
private struct TCaches
@@ -248,8 +241,9 @@ public class Rope : MonoBehaviour
if (!localOwnerAlwaysSimulate)
return false;
- var owner = _rod?.PlayerItem?.Owner;
- return owner == null || owner.IsSelf;
+ // var owner = _rod?.PlayerItem?.Owner;
+ // return owner == null || owner.IsSelf;
+ return true;
}
private Transform GetActiveCameraTransform()