提交测试代码
This commit is contained in:
@@ -12,6 +12,7 @@ namespace Test
|
||||
public float lineLength = 1f;
|
||||
public float floatLength = 0.5f;
|
||||
|
||||
public float Tension = 0;
|
||||
public void Start()
|
||||
{
|
||||
line.InitTest(rb);
|
||||
@@ -20,5 +21,49 @@ namespace Test
|
||||
line.Bobber.SetJointDistance(lineLength - floatLength);
|
||||
line.SetObiRopeStretch(lineLength - floatLength);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Debug.Log($"lineLength={lineLength}");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user