提交测试代码

This commit is contained in:
Bob.Song
2026-03-06 12:15:56 +08:00
parent 209049354c
commit 7127857199
37 changed files with 1269 additions and 270 deletions

View File

@@ -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);
}
}
}
}
}

View File

@@ -0,0 +1,16 @@
using UnityEngine;
namespace Test
{
public class CollisionTest : MonoBehaviour
{
private void OnCollisionEnter(Collision other)
{
Debug.Log($"OnCollisionEnter:{other.gameObject.name}");
}
private void OnCollisionExit(Collision other)
{
Debug.Log($"OnCollisionExit:{other.gameObject.name}");
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d5bfa3f53f894e7a87315e5cbc220e12
timeCreated: 1772767361