重新导入obi
This commit is contained in:
36
Assets/Scripts/Fishing/Rope/RopeByObi.cs
Normal file
36
Assets/Scripts/Fishing/Rope/RopeByObi.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user