首次提交

This commit is contained in:
Bob.Song
2026-03-05 18:07:55 +08:00
commit e125bb869e
4534 changed files with 563920 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
using UnityEngine;
namespace NBF
{
public class FBait : FGearBase
{
protected override void OnInit()
{
var baitConnector = Rod.Hook.hookAsset.baitConnector;
transform.position = baitConnector.position;
transform.SetParent(baitConnector);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ed7126c6f37c427e88ba321c63aeac2f
timeCreated: 1766582532

View File

@@ -0,0 +1,14 @@
using UnityEngine;
namespace NBF
{
public class FBobber : FGearBase
{
protected override void OnInit()
{
// transform.position = Rod.lineHandler.LineConnector_1.transform.position;
SetParent(Rod.Line.Bobber.transform);
transform.localPosition = Vector3.zero;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 89060cfcd521410caf2f00ae7ecfa135
timeCreated: 1766477995

View File

@@ -0,0 +1,9 @@
using UnityEngine;
namespace NBF
{
public class FFish : MonoBehaviour
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d76aeec1876a4df2a93e8e8dcaee30fa
timeCreated: 1766586324

View File

@@ -0,0 +1,36 @@
using Fantasy;
using UnityEngine;
namespace NBF
{
public abstract class FGearBase : MonoBehaviour
{
public FPlayer Player { get; protected set; }
public FRod Rod { get; protected set; }
public ItemInfo ItemInfo;
public virtual void Init(FPlayer player, FRod rod)
{
Player = player;
Rod = rod;
OnInit();
}
public void SetItemInfo(ItemInfo itemInfo)
{
ItemInfo = itemInfo;
}
protected void SetParent(Transform parent)
{
transform.SetParent(parent);
transform.localPosition = Vector3.zero;
transform.localEulerAngles = Vector3.zero;
transform.localScale = Vector3.one;
}
protected abstract void OnInit();
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 708753789f5b41f48b9b18197f54a9df
timeCreated: 1766582740

View File

@@ -0,0 +1,9 @@
using UnityEngine;
namespace NBF
{
public class FHandItem : MonoBehaviour
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5460b0f542fd45e38145b2a4fb12e329
timeCreated: 1766583615

View File

@@ -0,0 +1,30 @@
using UnityEngine;
namespace NBF
{
public class FHook : FGearBase
{
public HookAsset hookAsset;
private void Awake()
{
hookAsset = GetComponent<HookAsset>();
}
protected override void OnInit()
{
// transform.position = Rod.lineHandler.LineConnector_2.transform.position;
// transform.rotation = Rod.lineHandler.LineConnector_2.transform.rotation; // 确保旋转也同步
// SetParent(Rod.lineHandler.LineConnector_2.transform);
SetParent(Rod.Line.Lure.transform);
transform.localPosition = Vector3.zero;
// var target = lineHandler.LineConnector_2.GetComponent<Rigidbody>();
// var joint = Hook.gameObject.GetComponent<ConfigurableJoint>();
// joint.connectedBody = target;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0b4736177aeb4b70ba352e385554e5ab
timeCreated: 1766477615

View File

@@ -0,0 +1,127 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using NBC;
// using Obi;
using UnityEngine;
namespace NBF
{
public class FLine : FGearBase
{
// [SerializeField] private ObiParticleAttachment startParticleAttachment;
[SerializeField] private bool isLureConnect;
[SerializeField] private RodLine rodLine;
[SerializeField] private Rope fishingRope;
[SerializeField] private Rope bobberRope;
public LureController Lure;
public BobberController Bobber;
private float _groundSetting = 0.5f;
private float _LineOnSpool = 100f;
private float _LineThickness = 0.0007f;
public bool IsLure => isLureConnect;
// public event Action OnLinePulled;
protected override void OnInit()
{
var tipRb = Rod.Asset.LineConnectorRigidbody;
if (isLureConnect)
{
Lure.SetJoint(tipRb);
Lure.EnableCollision(false);
}
else
{
fishingRope.startAnchor = tipRb;
Bobber.SetJoint(tipRb);
Lure.SetJoint(Bobber.rbody);
Lure.gameObject.SetActive(true);
Lure.EnableCollision(false);
Lure.SetKinematic(false);
}
GetComponentsInChildren<Transform>(includeInactive: true).ToList().ForEach(delegate(Transform i)
{
i.gameObject.SetActive(true);
});
StartCoroutine(LureUseGravity());
if (isLureConnect)
{
fishingRope.Init(Rod);
}
else
{
fishingRope.Init(Rod);
bobberRope.Init(Rod);
}
// rodLine.GenerateLineRendererRope(guides.ToArray(), _LineThickness);
}
public void InitTest(Rigidbody tipRb)
{
if (isLureConnect)
{
Lure.SetJoint(tipRb);
Lure.EnableCollision(false);
}
else
{
fishingRope.startAnchor = tipRb;
Bobber.SetJoint(tipRb);
Lure.SetJoint(Bobber.rbody);
Lure.gameObject.SetActive(true);
Lure.EnableCollision(false);
Lure.SetKinematic(false);
}
GetComponentsInChildren<Transform>(includeInactive: true).ToList().ForEach(delegate(Transform i)
{
i.gameObject.SetActive(true);
});
StartCoroutine(LureUseGravity());
if (isLureConnect)
{
fishingRope.Init(Rod);
}
else
{
fishingRope.Init(Rod);
bobberRope.Init(Rod);
}
}
private IEnumerator LureUseGravity()
{
yield return 1;
Lure.gameObject.SetActive(false);
Lure.gameObject.SetActive(true);
yield return 1;
Lure.RBody.useGravity = true;
}
public void EnableLineRenderers()
{
// foreach (ObiRopeExtrudedRenderer item in GetComponentsInChildren<ObiRopeExtrudedRenderer>().ToList())
// {
// item.enabled = true;
// }
}
public void SetObiRopeStretch(float value)
{
Log.Error($"SetObiRopeStretch={value}");
fishingRope.SetTargetLength(value - 0.2f);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c0403ffd74ce46fab8bd4ef057e51432
timeCreated: 1766582567

View File

@@ -0,0 +1,194 @@
// using NBF;
// using Obi;
// using UnityEngine;
//
// public class FLineHandler : MonoBehaviour
// {
// public enum LineType
// {
// None = 0,
// OneSegment = 1,
// TwoSegment = 2,
// ThereSegment = 3
// }
//
// public LineType lineType = LineType.TwoSegment;
//
// // public ObiParticleAttachment startParticleAttachment;
//
// public ObiRope obiRopeSegment_1;
//
// public ObiRope obiRopeSegment_2;
//
// public ObiRope obiRopeSegment_3;
//
// public FixedLine LineConnector_0;
//
// public SpringJoint LineConnector_1;
//
// public SpringJoint LineConnector_2;
//
// public SpringJoint LineConnector_3;
//
// // [HideInInspector] public FFishingLine currentRodFishingLineComponent;
//
// // public ObiParticleAttachment toRodConnector;
//
// // public float PhisicsLineOut { get; set; }
//
// public float ObiLineOut;
//
// [HideInInspector] public Rigidbody EndLineRigidbody_0;
//
// [HideInInspector] public Rigidbody EndLineRigidbody_1;
//
// [HideInInspector] public Rigidbody EndLineRigidbody_2;
//
// [HideInInspector] public Rigidbody EndLineRigidbody_3;
//
// // public JointPinchController pinchController;
//
// public FRod Rod;
//
// private Transform waterPlane;
//
//
// public LineRenderer LineRenderer1;
// public LineRenderer LineRenderer2;
//
// // public float ropeToHookDistance;
//
// void Start()
// {
// ObiLineOut = obiRopeSegment_1.stretchingScale;
// if ((bool)LineConnector_0)
// {
// EndLineRigidbody_0 = LineConnector_0.GetComponent<Rigidbody>();
// }
//
// if ((bool)LineConnector_1)
// {
// EndLineRigidbody_1 = LineConnector_1.GetComponent<Rigidbody>();
// }
//
// if ((bool)LineConnector_2)
// {
// EndLineRigidbody_2 = LineConnector_2.GetComponent<Rigidbody>();
// // var fixedJoint = LineConnector_2.GetComponent<FixedJoint>();
// // pinchController = LineConnector_2.gameObject.AddComponent<JointPinchController>();
// }
//
// if ((bool)LineConnector_3)
// {
// EndLineRigidbody_3 = LineConnector_3.GetComponent<Rigidbody>();
// }
//
// waterPlane = GameObject.FindGameObjectWithTag("Water").transform;
//
// Debug.LogError($"rope.restLength={obiRopeSegment_1.restLength} LineConnector_1={LineConnector_1.maxDistance}");
// }
//
//
// void Update()
// {
// if (!Rod) return;
//
//
// // ropeToHookDistance = Vector3.Distance(toRodConnector.transform.position, LineConnector_1.transform.position);
//
// ObiLineOut = 0.1f + Rod.lineLength;
// float target = (0f - Mathf.Clamp(Rod.linelenghtDiferent, -1f, 0f)) * 0.1f;
// if (Rod.linelenghtDiferent >= 0f)
// {
// obiRopeSegment_1.stretchCompliance = Mathf.MoveTowards(obiRopeSegment_1.stretchCompliance, target,
// Time.smoothDeltaTime * (1f * Rod.linelenghtDiferent));
// }
// else
// {
// obiRopeSegment_1.stretchCompliance = Mathf.MoveTowards(obiRopeSegment_1.stretchCompliance, target,
// Time.smoothDeltaTime * 0.1f);
// }
//
// if (Rod.lineLength == 0f)
// {
// obiRopeSegment_1.stretchCompliance = 0f;
// }
//
// if ((bool)obiRopeSegment_2)
// {
// if (!Rod.currentFish)
// {
// obiRopeSegment_2.stretchCompliance = obiRopeSegment_2.stretchingScale * 0.004f;
// }
// else
// {
// obiRopeSegment_2.stretchCompliance = 0f;
// }
//
// //TODO:TEST
// obiRopeSegment_2.stretchingScale = 0.13F;
// }
//
// obiRopeSegment_1.stretchingScale = ObiLineOut;
// obiRopeSegment_1.stretchingScale = 1;
// LineConnector_1.maxDistance = 0.1f + Rod.lineLength;
// if (Input.GetKey(KeyCode.E))
// {
// // var speed = 1;
// // obiRopeCursor_1.ChangeLength(LineConnector_1.maxDistance);
// // Debug.Log(obiRopeSegment_1.restLength);
// }
//
// // var addLength = LineConnector_1.maxDistance - obiRopeSegment_1.restLength;
// // if (Mathf.Abs(addLength) > 0.001f)
// // {
// // obiRopeCursor_1.ChangeLength(LineConnector_1.maxDistance);
// // }
//
// // if (!Mathf.Approximately(LineConnector_1.maxDistance, obiRopeSegment_1.restLength))
// // {
// // obiRopeCursor_1.ChangeLength(LineConnector_1.maxDistance);
// // }
//
// // obiRopeCursor_1.pos
//
//
// // LineConnector_1.minDistance = LineConnector_1.maxDistance;
// }
//
//
// public void SetSegmentTwoLenght(float lenght)
// {
// LineConnector_2.maxDistance = lenght;
// // obiRopeCursor_2.ChangeLength(lenght);
// // LineConnector_2.minDistance = LineConnector_2.maxDistance;
// }
//
// private void FixedUpdate()
// {
// // BindRod();
// LineWaterDisplacement();
// }
//
// private void BindRod()
// {
// if (!Rod || !Rod.Asset) return;
// LineConnector_0.transform.position = Rod.Asset.lineConnector.position;
// }
//
// private void LineWaterDisplacement()
// {
// if (!waterPlane)
// {
// return;
// }
//
// for (int i = 0; i < obiRopeSegment_1.activeParticleCount; i++)
// {
// if (obiRopeSegment_1.GetParticlePosition(i).y < waterPlane.position.y)
// {
// // obiRopeSegment_1.AddForceParticle(i, Vector3.up * 10f, ForceMode.Acceleration);
// }
// }
// }
// }

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 331fde19f47e431092cf5bd57c7bcfe4
timeCreated: 1766586159

View File

@@ -0,0 +1,21 @@
using UnityEngine;
namespace NBF
{
public class FLure : FGearBase
{
protected override void OnInit()
{
// transform.position = Rod.lineHandler.LineConnector_1.transform.position;
// Lure.gameObject.GetComponent<ConfigurableJoint>().connectedBody =
// lineHandler.LineConnector_1.GetComponent<Rigidbody>();
// LureHookWaterDisplacement = Lure.GetComponent<FWaterDisplacement>();
// SetParent(Rod.lineHandler.LineConnector_1.transform);
SetParent(Rod.Line.Lure.transform);
transform.localPosition = Vector3.zero;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3f91ba5f4ca745d4b29fb2116781e25f
timeCreated: 1766478011

View File

@@ -0,0 +1,32 @@
using System.Collections;
using Fantasy;
using UnityEngine;
namespace NBF
{
public class FReel : FGearBase
{
public bool isBlockLineByFinger { get; set; }
[SerializeField] public float reelingDrag = 1f;
public ReelAsset Asset;
public ReelAnimator AnimatorCtrl;
private void Awake()
{
Asset = GetComponent<ReelAsset>();
AnimatorCtrl = Asset.animator.gameObject.GetComponent<ReelAnimator>();
if (AnimatorCtrl == null)
{
AnimatorCtrl = Asset.animator.gameObject.AddComponent<ReelAnimator>();
}
}
protected override void OnInit()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b48fc45344c5439c9d19897cb5987abf
timeCreated: 1766478030

View File

@@ -0,0 +1,350 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Fantasy;
using NBC.Asset;
using NBF.Utils;
using UnityEngine;
using Object = UnityEngine.Object;
namespace NBF
{
public class FRod : FHandItem
{
private float _tension;
/// <summary>
/// 可用的
/// </summary>
public bool Usable { get; private set; }
public RodAsset Asset;
public FPlayer Player { get; protected set; }
public ItemInfo ItemInfo;
public FReel Reel;
public FHook Hook;
public FBobber Bobber;
public FBait Bait;
public FLure Lure;
public FWeight Weight;
public FLine Line;
// /// <summary>
// /// 鱼线处理器
// /// </summary>
// public FLineHandler lineHandler;
public Transform GearRoot;
// public FWaterDisplacement LureHookWaterDisplacement;
[HideInInspector] public FFish currentFish;
public RodRingNode[] rings;
/// <summary>
/// 线长度
/// </summary>
public float lineLength = 1.5f;
/// <summary>
/// 浮漂线长度
/// </summary>
public float floatLength = 0.5f;
public float Tension
{
get => _tension;
private set
{
if (!Mathf.Approximately(_tension, value))
{
_tension = value;
// OnTensionChanged?.Invoke(_tension);
}
}
}
public float currentLineTension;
public float linelenghtDiferent;
public float currentLineStrenght;
private void Awake()
{
Asset = GetComponent<RodAsset>();
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Alpha0))
{
SetLineLength(lineLength);
}
else if (Input.GetKeyDown(KeyCode.Plus) || Input.GetKeyDown(KeyCode.Equals))
{
lineLength += 0.1f;
SetLineLength(lineLength);
}
else if (Input.GetKeyDown(KeyCode.Minus))
{
lineLength -= 0.1f;
SetLineLength(lineLength);
}
}
public void SetLineLength(float lineLength, bool stretchRope = true)
{
if (!Line) return;
if (Line.IsLure)
{
//没有浮漂类型
Line.Lure.SetJointDistance(lineLength);
if (stretchRope)
{
Line.SetObiRopeStretch(Tension > 0f ? 0f : lineLength);
}
}
else
{
//有浮漂
Line.Lure.SetJointDistance(floatLength);
Line.Bobber.SetJointDistance(lineLength - floatLength);
if (stretchRope)
{
Line.SetObiRopeStretch(Tension > 0f ? 0f : lineLength - floatLength);
}
}
}
private void LateUpdate()
{
Test();
}
public IEnumerator Destroy()
{
if (GearRoot != null)
{
Object.Destroy(GearRoot.gameObject);
}
yield return 1;
}
public IEnumerator InitRod(FPlayer player, ItemInfo itemInfo)
{
ItemInfo = itemInfo;
Player = player;
transform.localPosition = Vector3.zero;
transform.localRotation = Quaternion.identity;
transform.localScale = Vector3.one;
SceneSettings.Instance.GearNode.position = Player.transform.position;
yield return 1;
var obj = new GameObject($"rod_{itemInfo.Id}_{itemInfo.ConfigId}");
obj.transform.SetParent(SceneSettings.Instance.GearNode);
// obj.transform.SetParent(player.transform);
// obj.transform.localPosition = Vector3.zero;
obj.transform.position = player.transform.position;
obj.transform.rotation = player.transform.rotation;
obj.transform.localScale = Vector3.one;
GearRoot = obj.transform;
var parent = GearRoot;
List<ItemInfo> children = RoleModel.Instance.GetBindItems(itemInfo.Id);
ItemInfo lineItemInfo = null;
CreateFishingHandler();
yield return 1; //等待1帧
// children.Sort();
foreach (var child in children)
{
var itemType = child.ConfigId.GetItemType();
if (itemType == ItemType.Reel)
{
Reel = child.Config.InstantiateAndComponent<FReel>(Asset.ReelConnector, Vector3.zero,
Quaternion.identity);
Reel.SetItemInfo(child);
}
else if (itemType == ItemType.Bobber)
{
Bobber = child.Config.InstantiateAndComponent<FBobber>(parent, Vector3.zero,
Quaternion.identity);
Bobber.SetItemInfo(child);
}
else if (itemType == ItemType.Hook)
{
Hook = child.Config.InstantiateAndComponent<FHook>(parent, Vector3.zero,
Quaternion.identity);
Hook.SetItemInfo(child);
}
else if (itemType == ItemType.Bait)
{
Bait = child.Config.InstantiateAndComponent<FBait>(parent, Vector3.zero,
Quaternion.identity);
Bait.SetItemInfo(child);
}
else if (itemType == ItemType.Lure)
{
Lure = child.Config.InstantiateAndComponent<FLure>(parent, Vector3.zero,
Quaternion.identity);
Lure.SetItemInfo(child);
}
else if (itemType == ItemType.Weight)
{
Weight = child.Config.InstantiateAndComponent<FWeight>(parent, Vector3.zero,
Quaternion.identity);
Weight.SetItemInfo(child);
}
else if (itemType == ItemType.Line)
{
lineItemInfo = child;
}
}
yield return 1;
if (Reel)
{
Reel.reelingDrag = 0.699f;
Reel.transform.SetParent(Asset.ReelConnector);
Reel.transform.localPosition = Vector3.zero;
Reel.transform.localEulerAngles = Vector3.zero;
Reel.Init(player, this);
}
if (Bobber)
{
Bobber.Init(Player, this);
}
if (Hook)
{
Hook.Init(Player, this);
// LureHookWaterDisplacement = Hook.GetComponent<FWaterDisplacement>();
}
if (Bait)
{
Bait.Init(Player, this);
}
if (Lure)
{
Lure.Init(Player, this);
}
if (Weight)
{
Weight.Init(Player, this);
}
yield return 1; //等待1帧
transform.SetParent(Player.ModelAsset.RodRoot);
transform.localPosition = Vector3.zero;
transform.rotation = Player.ModelAsset.RodRoot.rotation;
Usable = true;
}
public void CreateFishingHandler()
{
if (Line == null)
{
Debug.LogError("创建钓组=====");
var rodType = (ItemSubType)ItemInfo.Config.Type;
if (rodType == ItemSubType.RodTele)
{
CreateObiFishingLine(0);
}
else if (rodType == ItemSubType.RodSpine || rodType == ItemSubType.RodBolo)
{
CreateObiFishingLine(1);
}
}
}
public void CreateObiFishingLine(int currentLineTypeIndex)
{
if (!Line)
{
var lineSolverPrefab = Assets.Load<GameObject>("Assets/ResRaw/Prefabs/Line/LineSolver.prefab");
var solver = Instantiate(lineSolverPrefab, GearRoot);
solver.transform.position = Asset.lineConnector.position;
solver.transform.rotation = Asset.lineConnector.rotation;
var indexNames = new[] { "fishing line float set", "fishing line spinning" };
var path =
$"Assets/ResRaw/Prefabs/Line/{indexNames[currentLineTypeIndex]}.prefab";
var prefab = Assets.Load<GameObject>(path);
GameObject obj = Instantiate(prefab, solver.transform);
obj.transform.localPosition = Vector3.zero;
obj.transform.localScale = Vector3.one;
obj.transform.rotation = Quaternion.identity;
Line = obj.GetComponent<FLine>();
Line.transform.position = Asset.lineConnector.position;
Line.Init(this.Player, this);
// var obiSolver = solver.GetComponent<ObiSolver>();
// obiSolver.parameters.ambientWind = Vector3.zero;
// obiSolver.wind.
// obiSolver.simulateWhenInvisible
}
}
public void SetRing(RodRingAsset ringAsset)
{
if (Asset.rings == null || Asset.rings.Length < 1) return;
var trans = ringAsset.rings;
RodRingNode lastRingNode = null;
List<RodRingNode> list = new List<RodRingNode>();
for (int i = 0; i < Asset.rings.Length; i++)
{
var ring = Asset.rings[i];
if (ring == null)
{
Log.Error($"ring is null,index={i}");
continue;
}
var lastName = ring.name.GetLastString();
foreach (var tran in trans)
{
var ringNode = tran.ring;
var lastName2 = ringNode.name.GetLastString();
if (lastName != lastName2) continue;
list.Add(tran);
ringNode.SetParent(ring);
ringNode.localPosition = Vector3.zero;
ringNode.localRotation = Quaternion.identity;
lastRingNode = tran;
break;
}
}
if (lastRingNode != null)
{
Asset.lineConnector = lastRingNode.point;
}
rings = list.ToArray();
}
private void Test()
{
// var root = Player.ModelAsset.RodRoot;
// if (!root) return;
// transform.SetPositionAndRotation(root.position, root.rotation);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ef4dfd89c0c34916be91b55490eb1c9f
timeCreated: 1766477316

View File

@@ -0,0 +1,233 @@
// using System.Collections;
// using Fantasy;
// using UnityEngine;
//
// namespace NBF
// {
// /// <summary>
// /// 虚拟钓组
// /// </summary>
// public class FVirtualTackle
// {
// private ItemInfo _itemInfo;
// private FPlayer _player;
//
//
// public FRod Rod;
//
//
// public FVirtualTackle(ItemInfo itemInfo, FPlayer player)
// {
// _itemInfo = itemInfo;
// _player = player;
// }
//
// public IEnumerator Create()
// {
// var parent = _player.transform;
// // parent.position = _player.transform.position;
//
//
// Rod = _itemInfo.Config.InstantiateAndComponent<FRod>(parent, Vector3.zero, Quaternion.identity);
//
//
// // var rodObject = _itemInfo.Config.Instantiate(parent, Vector3.zero, Quaternion.identity);
// // Rod = rodObject.GetComponent<FRod>();
// // if (Rod == null)
// // {
// // Rod = rodObject.AddComponent<FRod>();
// // }
// // var rodConfig = RodConfig.Get(itemInfo.ConfigId);
// // itemInfo.Config
//
// // var data = Player.Data.currentGear;
// // var rodConfig = data.rod.Config;
// // var cloneObj = rodConfig.Instantiate(parent, Vector3.zero, Player.MainArm.RodContainer.rotation);
// // if (cloneObj == null)
// // {
// // yield break;
// // }
// //
// // Rod = cloneObj.GetComponent<FRod>();
// // if (Rod == null)
// // {
// // Rod = cloneObj.AddComponent<FRod>();
// // }
// //
// //
// // if (Rod)
// // {
// // Rod.transform.localPosition = Vector3.zero;
// // Rod.transform.rotation = Player.MainArm.RodContainer.rotation;
// //
// // if (rodConfig.ring > 0)
// // {
// // var ringConfig = GameRings.Get(rodConfig.ring);
// // var ringObject = ringConfig.Instantiate(Rod.transform);
// // ringObject.SetActive(false);
// // Rod.SetRing(ringObject.GetComponent<RodRingAsset>());
// // }
// // }
// // else
// // {
// // yield break;
// // }
// //
// // if (data.line != null)
// // {
// // var linePrefab = data.line.Config.Instantiate(parent);
// // Line = linePrefab.GetComponent<FLine>();
// // }
// //
// // if (data.reel != null)
// // {
// // var reelPrefab = data.reel.Config.Create(parent);
// // Reel = reelPrefab.GetComponent<FReel>();
// // }
// //
// // if (data.bobber != null)
// // {
// // var bobberPrefab = data.bobber.Config.Create(parent);
// // Bobber = bobberPrefab.GetComponent<FFloat>();
// // }
// //
// // if (data.hook != null)
// // {
// // var hookPrefab = data.hook.Config.Create(parent);
// // Hook = hookPrefab.GetComponent<FHook>();
// // }
// //
// // if (data.bait != null)
// // {
// // var baitPrefab = data.bait.Config.Create(parent);
// //
// // if (baitPrefab.TryGetComponent<FBait>(out var bait))
// // {
// // Bait = bait;
// // }
// // }
// //
// // if (data.lure != null)
// // {
// // var baitPrefab = data.lure.Config.Create(parent);
// // if (baitPrefab.TryGetComponent<FLure>(out var lure))
// // {
// // Lure = lure;
// // }
// // }
// //
// //
// // if (data.weight != null)
// // {
// // var weightPrefab = data.weight.Config.Instantiate(parent);
// // Weight = weightPrefab.GetComponent<FWeight>();
// // }
// //
// // Debug.LogError("CreateOrHideGear");
// // yield return 1;
// // Rod.Initialize(Player, data.rod);
// // Rod.CreateFishingHandler();
// //
// // if (Line)
// // {
// // Line.Initialize(Player, data.line);
// //
// //
// // if ((bool)Rod.lineHandler.obiRopeSegment_1)
// // {
// // Rod.lineHandler.obiRopeSegment_1.GetComponent<MeshRenderer>().material =
// // Line.lineMat;
// // }
// //
// // if ((bool)Rod.lineHandler.obiRopeSegment_2)
// // {
// // Rod.lineHandler.obiRopeSegment_2.GetComponent<MeshRenderer>().material =
// // Line.lineMat;
// // }
// //
// // if ((bool)Rod.lineHandler.obiRopeSegment_3)
// // {
// // Rod.lineHandler.obiRopeSegment_3.GetComponent<MeshRenderer>().material =
// // Line.lineMat;
// // }
// // }
// //
// // if (Reel)
// // {
// // // Reel.maxReelStrength = data.reel.Config.strength;
// // // Reel.reelingSpeed = 0.5f; //slotsEquip.reel.currentSpeed;
// // Reel.reelingDrag = 0.699f; //slotsEquip.reel.currentDrag;
// // Reel.transform.SetParent(Rod.rodAsset.ReelConnector);
// // Reel.transform.localPosition = Vector3.zero;
// // Reel.transform.localEulerAngles = Vector3.zero;
// // // Reel.reelAsset.szpulaObject.GetComponent<MeshRenderer>().material = Line.szpulaMat;
// // Reel.Initialize(Player, data.reel);
// // }
// //
// // if (Bobber)
// // {
// // Bobber.floatDisplacement = data.bobber.Config.displacement;
// // // if ((double)slotsEquip.ffloat.lastSetGroundValue > 0.2)
// // // {
// // // Bobber.newDeepth = slotsEquip.ffloat.lastSetGroundValue;
// // // }
// //
// // Bobber.newDeepth = 0.5f;
// //
// // Bobber.Initialize(Player, data.bobber);
// // Bobber.transform.position = Rod.lineHandler.LineConnector_1.transform.position;
// // Bobber.gameObject.GetComponent<ConfigurableJoint>().connectedBody =
// // Rod.lineHandler.LineConnector_1.GetComponent<Rigidbody>();
// // }
// //
// //
// // if (Hook)
// // {
// // Hook.Initialize(Player, data.hook);
// //
// // Hook.transform.position = Rod.lineHandler.LineConnector_2.transform.position;
// // Hook.transform.rotation = Rod.lineHandler.LineConnector_2.transform.rotation; // 确保旋转也同步
// // var target = Rod.lineHandler.LineConnector_2.GetComponent<Rigidbody>();
// // var joint = Hook.gameObject.GetComponent<ConfigurableJoint>();
// // // // 关键设置:关闭自动锚点计算,手动设置锚点
// // // joint.autoConfigureConnectedAnchor = false;
// // // joint.anchor = Vector3.zero; // 以 Hook 自身中心为锚点
// // // joint.connectedAnchor = Vector3.zero; // 以目标物体的中心为锚点
// // joint.connectedBody = target;
// // // // 强制物理引擎立即更新变换避免1帧延迟
// // // Physics.SyncTransforms();
// // // joint.autoConfigureConnectedAnchor = false;
// // // joint.anchor = Vector3.zero;
// // // joint.connectedAnchor = Vector3.zero;
// // Rod.LureHookWaterDisplacement = Hook.GetComponent<FWaterDisplacement>();
// // }
// //
// // if (Bait)
// // {
// // Bait.Initialize(Player, data.bait);
// // Bait.transform.position = Hook.hookAsset.baitConnector.position;
// // Bait.transform.SetParent(Hook.hookAsset.baitConnector);
// // }
// //
// // if (Lure)
// // {
// // Lure.Initialize(Player, data.bait);
// // Lure.transform.position = Rod.lineHandler.LineConnector_1.transform.position;
// // Lure.gameObject.GetComponent<ConfigurableJoint>().connectedBody =
// // Rod.lineHandler.LineConnector_1.GetComponent<Rigidbody>();
// // Rod.LureHookWaterDisplacement = Lure.GetComponent<FWaterDisplacement>();
// // }
// //
// // if (Weight)
// // {
// // Weight.weight = data.weight.Config.weight;
// // Weight.Initialize(Player, data.weight);
// // }
// }
//
// public IEnumerator Destroy()
// {
// yield return 1;
// }
// }
// }

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4092f341d83540c0b6ba0e2db3669f1b
timeCreated: 1766478162

View File

@@ -0,0 +1,12 @@
using UnityEngine;
namespace NBF
{
public class FWeight : FGearBase
{
protected override void OnInit()
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a68c58e07092402dbc37a5f287e70b9b
timeCreated: 1766582543