重新导入obi

This commit is contained in:
2026-04-06 11:35:18 +08:00
parent 05fa2d6e5e
commit ae3002a0e2
1643 changed files with 232496 additions and 13 deletions

View File

@@ -0,0 +1,12 @@
using UnityEngine;
namespace NBF
{
/// <summary>
/// 鱼线脚本
/// </summary>
public interface IRope
{
void SetLineLength(float length);
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e702dc5afb0a467e9e01a920d959a977
timeCreated: 1775445873

View File

@@ -0,0 +1,22 @@
using UnityEngine;
namespace NBF
{
public abstract class RopeBase : MonoBehaviour, IRope
{
[Header("Anchors")] [SerializeField] public Rigidbody startAnchor;
[SerializeField] public Rigidbody endAnchor;
public float CurrentLength { get; protected set; }
public void SetLineLength(float length)
{
CurrentLength = length;
}
protected virtual void OnSetLineLength(float length)
{
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2b39290e64e04f27a02a273fab64d461
timeCreated: 1775446264

View File

@@ -0,0 +1,36 @@
using Obi;
using UnityEngine;
namespace NBF
{
/// <summary>
/// 基于obi rope的鱼线控制脚本
/// </summary>
public class RopeByObi : RopeBase
{
[SerializeField] private ObiRope rope;
[SerializeField] private ObiRopeCursor cursor;
[SerializeField] private float percentageElasticity = 0.2f;
private float _stretchScale;
private void Awake()
{
rope = GetComponent<ObiRope>();
}
private void Update()
{
rope.stretchingScale = _stretchScale;
}
protected override void OnSetLineLength(float length)
{
cursor = ((cursor == null) ? GetComponent<ObiRopeCursor>() : cursor);
_stretchScale = Mathf.Clamp(length - percentageElasticity, 0f, float.PositiveInfinity);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8b7f9ea147004095b3e8390654d061a9
timeCreated: 1775445787