line修改
This commit is contained in:
@@ -14,7 +14,6 @@ namespace NBF
|
||||
public LineType LineType;
|
||||
|
||||
[SerializeField] private bool isLureConnect;
|
||||
[SerializeField] private RodLine rodLine;
|
||||
|
||||
/// <summary>
|
||||
/// 主线
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
1094
Assets/Scripts/Fishing/New/View/FishingLine/Rope.cs
Normal file
1094
Assets/Scripts/Fishing/New/View/FishingLine/Rope.cs
Normal file
File diff suppressed because it is too large
Load Diff
3
Assets/Scripts/Fishing/New/View/FishingLine/Rope.cs.meta
Normal file
3
Assets/Scripts/Fishing/New/View/FishingLine/Rope.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98ba9d435a0e49c9bb527c34cc91894d
|
||||
timeCreated: 1766759607
|
||||
Reference in New Issue
Block a user