line修改

This commit is contained in:
Bob.Song
2026-04-16 16:36:09 +08:00
parent 9681d7526f
commit f2803c9d74
11 changed files with 804 additions and 1072 deletions

View File

@@ -14,7 +14,6 @@ namespace NBF
public LineType LineType;
[SerializeField] private bool isLureConnect;
[SerializeField] private RodLine rodLine;
/// <summary>
/// 主线

View File

@@ -14,13 +14,13 @@ namespace NBF
Tail
}
private FLine _solver;
[SerializeField] private FLine _solver;
[Header("Node")] [SerializeField] private NodeType nodeType = NodeType.Tail;
[SerializeField] public Rigidbody body;
[SerializeField] private Rope _rope;
public Rope Rope;
[SerializeField] private MonoBehaviour interaction;
private ConfigurableJoint _joint;
[SerializeField] private ConfigurableJoint _joint;
[Header("Segment To Next Logical Node")] [Min(0f)] [SerializeField]
private float segmentLengthToNext = 0.5f;
@@ -63,8 +63,8 @@ namespace NBF
private void Awake()
{
_solver = GetComponentInParent<FLine>();
_joint = GetComponent<ConfigurableJoint>();
if (!_solver) _solver = GetComponentInParent<FLine>();
if (!_joint) _joint = GetComponent<ConfigurableJoint>();
EnsureFeatureCache();
}
@@ -97,7 +97,7 @@ namespace NBF
if (!Mathf.Approximately(lenght, _joint.linearLimit.limit))
{
_joint.linearLimit = new SoftJointLimit() { limit = lenght };
_rope.SetTargetLength(lenght - 0.1f);
Rope.SetTargetLength(lenght - 0.1f);
}
}

View File

@@ -37,8 +37,14 @@ namespace NBF
// });
}
private void Awake()
{
}
private void Start()
{
InitRenderer();
GetComponentsInChildren<Transform>(includeInactive: true).ToList().ForEach(delegate(Transform i)
{
i.gameObject.SetActive(true);
@@ -268,5 +274,33 @@ namespace NBF
}
#endregion
#region Renderer
private Transform _ropeRoot;
private void InitRenderer()
{
var root = new GameObject("RopeRoot");
_ropeRoot = root.transform;
_ropeRoot.SetParent(transform);
CreateRopes();
}
private void CreateRopes()
{
foreach (var node in LogicalNodes)
{
if (node.Type == FishingLineNode.NodeType.Start) continue;
var ropeObject = new GameObject($"rope_{node.Type}");
ropeObject.transform.SetParent(_ropeRoot);
var rope = ropeObject.AddComponent<Rope>();
node.Rope = rope;
rope.startAnchor = node.Joint.connectedBody;
rope.endAnchor = node.body;
}
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 98ba9d435a0e49c9bb527c34cc91894d
timeCreated: 1766759607