重新导入obi

This commit is contained in:
2026-04-06 11:35:18 +08:00
parent 05fa2d6e5e
commit ae3002a0e2
1643 changed files with 232496 additions and 13 deletions

View File

@@ -0,0 +1,45 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
[RequireComponent(typeof(ObiRope))]
public class CursorController : MonoBehaviour
{
ObiRopeCursor cursor;
ObiRope rope;
public float minLength = 0.1f;
public float speed = 1;
// Use this for initialization
void Start ()
{
rope = GetComponent<ObiRope>();
cursor = GetComponent<ObiRopeCursor>();
}
// Update is called once per frame
void Update ()
{
if (Input.GetKey(KeyCode.W) && cursor != null)
{
if (rope.restLength > minLength)
cursor.ChangeLength(rope.restLength - speed * Time.deltaTime);
}
if (Input.GetKey(KeyCode.S) && cursor != null)
{
cursor.ChangeLength(rope.restLength + speed * Time.deltaTime);
}
if (Input.GetKey(KeyCode.A)){
rope.transform.Translate(Vector3.left * Time.deltaTime,Space.World);
}
if (Input.GetKey(KeyCode.D)){
rope.transform.Translate(Vector3.right * Time.deltaTime,Space.World);
}
}
}