提交修改

This commit is contained in:
Bob.Song
2026-04-14 18:07:22 +08:00
parent 2a5f266400
commit 1a72c3f52a
8 changed files with 1636 additions and 1345 deletions

View File

@@ -1,19 +1,39 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace NBF
{
[RequireComponent(typeof(LineRenderer))]
public class FishingLineRenderer : MonoBehaviour
{
[Header("References")] [SerializeField]
private FishingLineSolver solver;
[SerializeField] private LineRenderer lineRenderer;
private List<FishingNodeRope> _ropes = new List<FishingNodeRope>();
private Transform _ropeRoot;
private void Awake()
{
lineRenderer = GetComponent<LineRenderer>();
solver = GetComponent<FishingLineSolver>();
var ropeRoot = new GameObject("RopeRenderer");
ropeRoot.transform.SetParent(transform);
_ropeRoot = ropeRoot.transform;
}
private void Start()
{
foreach (var node in solver.LogicalNodes)
{
if (node.Type == FishingLineNode.NodeType.Start) continue;
var ropeObj = new GameObject($"Rope_{node.Type}");
ropeObj.transform.SetParent(_ropeRoot);
var rope = ropeObj.AddComponent<FishingNodeRope>();
rope.startAnchor = node.Joint.connectedBody;
rope.endAnchor = node.body;
rope.SetLength(0.5f);
_ropes.Add(rope);
}
}
}
}

View File

@@ -1,3 +1,3 @@
fileFormatVersion: 2
guid: 98ba9d435a0e49c9bb527c34cc91894d
timeCreated: 1766759607
fileFormatVersion: 2
guid: 53f61ff2ae804a41a3ac35ea7bd00b20
timeCreated: 1776157309

File diff suppressed because it is too large Load Diff

View File

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