Merge branch 'master' of https://git.bobsong.cn/Game/Fishing2
# Conflicts: # Assets/Scenes/BobberTest.unity # UserSettings/EditorUserSettings.asset
This commit is contained in:
@@ -235,6 +235,27 @@ public class Rope : MonoBehaviour
|
||||
public void SetTargetLength(float lengthMeters) => _targetLength = Mathf.Max(0f, lengthMeters);
|
||||
public float GetCurrentLength() => _currentLength;
|
||||
public float GetTargetLength() => _targetLength;
|
||||
|
||||
public float GetLengthSmoothVel() => _lengthSmoothVel;
|
||||
|
||||
public float GetLengthByPoints()
|
||||
{
|
||||
if (_rPoints == null || _lineRenderer == null) return 0f;
|
||||
|
||||
int count = _lineRenderer.positionCount;
|
||||
if (count < 2) return 0f;
|
||||
|
||||
float totalLength = 0f;
|
||||
for (int i = 1; i < count; i++)
|
||||
{
|
||||
Vector3 a = _rPoints[i - 1];
|
||||
Vector3 b = _rPoints[i];
|
||||
totalLength += Vector3.Distance(a, b);
|
||||
}
|
||||
|
||||
return totalLength;
|
||||
}
|
||||
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
|
||||
@@ -9,6 +9,8 @@ namespace NBF
|
||||
// transform.position = Rod.lineHandler.LineConnector_1.transform.position;
|
||||
SetParent(Rod.Line.Bobber.transform);
|
||||
transform.localPosition = Vector3.zero;
|
||||
var buoyancy = GetComponentInParent<CapsuleBuoyancyStable>();
|
||||
buoyancy.InitBobber();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@ namespace NBF
|
||||
public void SetObiRopeStretch(float value)
|
||||
{
|
||||
Log.Error($"SetObiRopeStretch={value}");
|
||||
fishingRope.SetTargetLength(value - 0.2f);
|
||||
fishingRope.SetTargetLength(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user