提交修改
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98ba9d435a0e49c9bb527c34cc91894d
|
||||
timeCreated: 1766759607
|
||||
fileFormatVersion: 2
|
||||
guid: 53f61ff2ae804a41a3ac35ea7bd00b20
|
||||
timeCreated: 1776157309
|
||||
1043
Assets/Scripts/Fishing/New/View/FishingLine/Renderer/Rope.cs
Normal file
1043
Assets/Scripts/Fishing/New/View/FishingLine/Renderer/Rope.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98ba9d435a0e49c9bb527c34cc91894d
|
||||
timeCreated: 1766759607
|
||||
Reference in New Issue
Block a user