测试代码提交

This commit is contained in:
Bob.Song
2026-03-26 16:03:53 +08:00
parent 83da5b3196
commit 7f0255574c
5 changed files with 48 additions and 15 deletions

View File

@@ -123,5 +123,11 @@ namespace NBF
}
fishingRope.SetTargetLength(value);
}
public void SetLureLength(float value)
{
Log.Error($"SetObiRopeStretch={value}");
bobberRope.SetTargetLength(value);
}
}
}

View File

@@ -1,4 +1,5 @@
using System;
using DG.Tweening;
using NBF;
using UnityEngine;
@@ -9,10 +10,13 @@ namespace Test
public Rigidbody rb;
public FLine line;
public Transform Terrain;
public float lineLength = 1f;
public float floatLength = 0.5f;
public float Tension = 0;
public void Start()
{
line.InitTest(rb);
@@ -20,8 +24,9 @@ namespace Test
line.Lure.SetJointDistance(floatLength);
line.Bobber.SetJointDistance(lineLength - floatLength);
line.SetTargetLength(lineLength - floatLength);
line.SetLureLength(floatLength);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Alpha0))
@@ -38,8 +43,18 @@ namespace Test
lineLength -= 0.1f;
SetLineLength(lineLength);
}
else if (Input.GetKeyDown(KeyCode.K))
{
var pos = Terrain.localPosition;
Terrain.DOLocalMoveY(pos.y - 0.02f, 0.2f);
}
else if (Input.GetKeyDown(KeyCode.L))
{
var pos = Terrain.localPosition;
Terrain.DOLocalMoveY(pos.y + 0.02f, 0.2f);
}
}
public void SetLineLength(float lineLength, bool stretchRope = true)
{
Debug.Log($"lineLength={lineLength}");
@@ -64,6 +79,5 @@ namespace Test
}
}
}
}
}