From 69bb9c93fb7421f2fa34c0142ba0000f16dcdbc6 Mon Sep 17 00:00:00 2001 From: "Bob.Song" <605277374@qq.com> Date: Mon, 13 Apr 2026 20:48:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/AssetCaches.asset | 15 + .../Line/fishing line float set 1.prefab | 427 ++++++++++++++++++ .../Line/fishing line float set 1.prefab.meta | 12 + .../View/FishingLine/FishingLineRenderer.cs | 19 + .../FishingLine/FishingLineRenderer.cs.meta | 3 + .../New/View/FishingLine/FishingLineSolver.cs | 86 +++- 6 files changed, 561 insertions(+), 1 deletion(-) create mode 100644 Assets/ResRaw/Prefabs/Line/fishing line float set 1.prefab create mode 100644 Assets/ResRaw/Prefabs/Line/fishing line float set 1.prefab.meta create mode 100644 Assets/Scripts/Fishing/New/View/FishingLine/FishingLineRenderer.cs create mode 100644 Assets/Scripts/Fishing/New/View/FishingLine/FishingLineRenderer.cs.meta diff --git a/Assets/AssetCaches.asset b/Assets/AssetCaches.asset index 84b305f98..0e0626483 100644 --- a/Assets/AssetCaches.asset +++ b/Assets/AssetCaches.asset @@ -18553,6 +18553,21 @@ MonoBehaviour: - {fileID: 102900000, guid: 60ac19fbbe20cec48add96b79332c113, type: 3} FilterEnum: 0 Filter: '*' + - Path: Assets/ResRaw/Prefabs/Line/fishing line float set 1.prefab + Address: Plyaer/fishing line float set 1 + Type: GameObject + Bundle: main/plyaer.bundle + Tags: + Group: + Name: Plyaer + Enable: 1 + BundleMode: 0 + AddressMode: 2 + Tags: + Collectors: + - {fileID: 102900000, guid: aa3f5467c0c153642ac320466aee0ec1, type: 3} + FilterEnum: 0 + Filter: '*' - Path: Assets/ResRaw/Prefabs/Line/fishing line float set.prefab Address: Plyaer/fishing line float set Type: GameObject diff --git a/Assets/ResRaw/Prefabs/Line/fishing line float set 1.prefab b/Assets/ResRaw/Prefabs/Line/fishing line float set 1.prefab new file mode 100644 index 000000000..1a95860e8 --- /dev/null +++ b/Assets/ResRaw/Prefabs/Line/fishing line float set 1.prefab @@ -0,0 +1,427 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1035052809208993 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4026445325167852} + - component: {fileID: 54679398375713381} + - component: {fileID: 153611279189314279} + - component: {fileID: 135844594273256032} + - component: {fileID: 7176287465780574680} + m_Layer: 15 + m_Name: Lure + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4026445325167852 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1035052809208993} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -1.5, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4283454774123242} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!54 &54679398375713381 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1035052809208993} + serializedVersion: 5 + m_Mass: 0.01 + m_LinearDamping: 1 + m_AngularDamping: 0.1 + m_CenterOfMass: {x: 0, y: 0, z: 0} + m_InertiaTensor: {x: 0.001, y: 0.001, z: 0.001} + m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ImplicitCom: 1 + m_ImplicitTensor: 0 + m_UseGravity: 0 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 2 +--- !u!153 &153611279189314279 +ConfigurableJoint: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1035052809208993} + serializedVersion: 4 + m_ConnectedBody: {fileID: 54298866000586118} + m_ConnectedArticulationBody: {fileID: 0} + m_Anchor: {x: 0, y: 0, z: 0} + m_Axis: {x: 0, y: 0, z: 0} + m_AutoConfigureConnectedAnchor: 0 + m_ConnectedAnchor: {x: 0, y: 0, z: 0} + m_SecondaryAxis: {x: 0, y: 0, z: 0} + m_XMotion: 1 + m_YMotion: 1 + m_ZMotion: 1 + m_AngularXMotion: 2 + m_AngularYMotion: 2 + m_AngularZMotion: 2 + m_LinearLimitSpring: + spring: 0 + damper: 0 + m_LinearLimit: + limit: 0.5 + bounciness: 0 + contactDistance: 0 + m_AngularXLimitSpring: + spring: 0 + damper: 0 + m_LowAngularXLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_HighAngularXLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_AngularYZLimitSpring: + spring: 0 + damper: 0 + m_AngularYLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_AngularZLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_TargetPosition: {x: 0, y: 0, z: 0} + m_TargetVelocity: {x: 0, y: 0, z: 0} + m_XDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_YDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_ZDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_TargetRotation: {x: 0, y: 0, z: 0, w: 1} + m_TargetAngularVelocity: {x: 0, y: 0, z: 0} + m_RotationDriveMode: 0 + m_AngularXDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_AngularYZDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_SlerpDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_ProjectionMode: 1 + m_ProjectionDistance: 0 + m_ProjectionAngle: 0 + m_ConfiguredInWorldSpace: 0 + m_SwapBodies: 0 + m_BreakForce: Infinity + m_BreakTorque: Infinity + m_EnableCollision: 0 + m_EnablePreprocessing: 0 + m_MassScale: 1 + m_ConnectedMassScale: 1 +--- !u!135 &135844594273256032 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1035052809208993} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Radius: 0.003 + m_Center: {x: 0, y: -0.0015, z: 0} +--- !u!114 &7176287465780574680 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1035052809208993} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee9704c2e1594f4cab270bfd4ca2210b, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::NBF.FishingLineNode + nodeType: 3 + body: {fileID: 54679398375713381} +--- !u!1 &1387836627839849 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4283454774123242} + - component: {fileID: 7859179875146676465} + m_Layer: 0 + m_Name: fishing line float set 1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4283454774123242 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1387836627839849} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4530253318796540} + - {fileID: 4026445325167852} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &7859179875146676465 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1387836627839849} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fd39a2e024a0477c9ad5698d80d9a63a, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::NBF.FishingLineSolver + logicalNodes: + - {fileID: 8342656697567645068} + - {fileID: 7176287465780574680} +--- !u!1 &1858052053854210 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4530253318796540} + - component: {fileID: 54298866000586118} + - component: {fileID: 153691655494134957} + - component: {fileID: 8342656697567645068} + m_Layer: 15 + m_Name: Float + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4530253318796540 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858052053854210} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: -1, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 4283454774123242} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!54 &54298866000586118 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858052053854210} + serializedVersion: 5 + m_Mass: 0.1 + m_LinearDamping: 1 + m_AngularDamping: 0.1 + m_CenterOfMass: {x: 0, y: 0, z: 0} + m_InertiaTensor: {x: 0.001, y: 0.001, z: 0.001} + m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ImplicitCom: 1 + m_ImplicitTensor: 0 + m_UseGravity: 1 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 2 +--- !u!153 &153691655494134957 +ConfigurableJoint: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858052053854210} + serializedVersion: 4 + m_ConnectedBody: {fileID: 0} + m_ConnectedArticulationBody: {fileID: 0} + m_Anchor: {x: 0, y: -0.01, z: 0} + m_Axis: {x: 0, y: 0, z: 0} + m_AutoConfigureConnectedAnchor: 0 + m_ConnectedAnchor: {x: 0, y: 0, z: 0} + m_SecondaryAxis: {x: 0, y: 0, z: 0} + m_XMotion: 1 + m_YMotion: 1 + m_ZMotion: 1 + m_AngularXMotion: 2 + m_AngularYMotion: 2 + m_AngularZMotion: 2 + m_LinearLimitSpring: + spring: 0 + damper: 0 + m_LinearLimit: + limit: 0.5 + bounciness: 0 + contactDistance: 0 + m_AngularXLimitSpring: + spring: 0 + damper: 0 + m_LowAngularXLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_HighAngularXLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_AngularYZLimitSpring: + spring: 0 + damper: 0 + m_AngularYLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_AngularZLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_TargetPosition: {x: 0, y: 0, z: 0} + m_TargetVelocity: {x: 0, y: 0, z: 0} + m_XDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_YDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_ZDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_TargetRotation: {x: 0, y: 0, z: 0, w: 1} + m_TargetAngularVelocity: {x: 0, y: 0, z: 0} + m_RotationDriveMode: 0 + m_AngularXDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_AngularYZDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_SlerpDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_ProjectionMode: 1 + m_ProjectionDistance: 0 + m_ProjectionAngle: 0 + m_ConfiguredInWorldSpace: 0 + m_SwapBodies: 0 + m_BreakForce: Infinity + m_BreakTorque: Infinity + m_EnableCollision: 0 + m_EnablePreprocessing: 0 + m_MassScale: 1 + m_ConnectedMassScale: 1 +--- !u!114 &8342656697567645068 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858052053854210} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ee9704c2e1594f4cab270bfd4ca2210b, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::NBF.FishingLineNode + nodeType: 1 + body: {fileID: 54298866000586118} diff --git a/Assets/ResRaw/Prefabs/Line/fishing line float set 1.prefab.meta b/Assets/ResRaw/Prefabs/Line/fishing line float set 1.prefab.meta new file mode 100644 index 000000000..ce9528fce --- /dev/null +++ b/Assets/ResRaw/Prefabs/Line/fishing line float set 1.prefab.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 449040ff936513f4ba4b9715db2f4bf7 +timeCreated: 1762387921 +licenseType: Free +PrefabImporter: + externalObjects: {} + addedObjectFileIDs: + isPrefabVariant: 0 + variantParentGUID: 00000000000000000000000000000000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineRenderer.cs b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineRenderer.cs new file mode 100644 index 000000000..7c529d3a3 --- /dev/null +++ b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineRenderer.cs @@ -0,0 +1,19 @@ +using UnityEngine; + +namespace NBF +{ + [RequireComponent(typeof(LineRenderer))] + public class FishingLineRenderer : MonoBehaviour + { + [Header("References")] [SerializeField] + private FishingLineSolver solver; + + [SerializeField] private LineRenderer lineRenderer; + + private void Awake() + { + lineRenderer = GetComponent(); + solver = GetComponent(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineRenderer.cs.meta b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineRenderer.cs.meta new file mode 100644 index 000000000..3478d657d --- /dev/null +++ b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineRenderer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 14537bf263784fcd8aaf130eb3c51350 +timeCreated: 1776084149 \ No newline at end of file diff --git a/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineSolver.cs b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineSolver.cs index 83d8dcee7..24cb37315 100644 --- a/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineSolver.cs +++ b/Assets/Scripts/Fishing/New/View/FishingLine/FishingLineSolver.cs @@ -1,8 +1,92 @@ -using UnityEngine; +using System; +using System.Collections.Generic; +using UnityEngine; namespace NBF { public class FishingLineSolver : MonoBehaviour { + [SerializeField] private FishingLineNode[] logicalNodes = Array.Empty(); + + + #region LineNode + + /// + /// 当前配置的逻辑节点只读列表。 + /// 外部可读取节点顺序,但不应直接修改数组内容。 + /// + public IReadOnlyList LogicalNodes => logicalNodes; + + + /// + /// 获取指定顺序索引的逻辑节点。 + /// 索引基于 logicalNodes 配置顺序;超出范围或节点为空时返回 null。 + /// + public FishingLineNode GetLogicalNode(int logicalIndex) + { + if (logicalNodes == null || logicalIndex < 0 || logicalIndex >= logicalNodes.Length) + { + return null; + } + + return logicalNodes[logicalIndex]; + } + + /// + /// 获取当前起点逻辑节点。 + /// 会返回配置顺序中第一个非空节点。 + /// + public FishingLineNode GetStartNode() + { + return FindFirstValidLogicalNode(); + } + + /// + /// 获取当前终点逻辑节点。 + /// 会返回配置顺序中最后一个非空节点。 + /// + public FishingLineNode GetEndNode() + { + return FindLastValidLogicalNode(); + } + + private FishingLineNode FindFirstValidLogicalNode() + { + if (logicalNodes == null) + { + return null; + } + + for (var i = 0; i < logicalNodes.Length; i++) + { + if (logicalNodes[i] != null) + { + return logicalNodes[i]; + } + } + + return null; + } + + private FishingLineNode FindLastValidLogicalNode() + { + if (logicalNodes == null) + { + return null; + } + + for (var i = logicalNodes.Length - 1; i >= 0; i--) + { + if (logicalNodes[i] != null) + { + return logicalNodes[i]; + } + } + + return null; + } + + #endregion + } } \ No newline at end of file