using PhysicsTools; using UnityEngine; using UnityEngine.UI; public class Scene2Events : MonoBehaviour { private Rope rope; public Text txtHelp; public float speed = 0.01f; private void Start() { string text = "Camera Control\r\nDrag Mouse To Rotate\r\nArrow Keys and Page Up/Down to move\r\n\r\n'Space': Throw a ball in direction of camera\r\n'r': Reset the scene\r\n'i': Increase length\r\n'd': Decrease length\r\n's': Stop changing length"; txtHelp.text = text; GameObject gameObject = GameObject.Find("Rope"); rope = gameObject.GetComponent(); } private void Update() { if (Input.GetKeyDown(KeyCode.I)) { rope.rate = speed; } else if (Input.GetKeyDown(KeyCode.D)) { if (rope.getSegments().Count > 2) { rope.rate = 0f - speed; } } else if (Input.GetKeyDown(KeyCode.S)) { rope.rate = 0f; } } }