using PhysicsTools; using UnityEngine; using UnityEngine.UI; public class Scene1Events : MonoBehaviour { public Text txtHelp; 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'b': Break randomly a random rope"; txtHelp.text = text; } private void Update() { if (Input.GetKeyDown(KeyCode.B)) { float value = Random.value; string text = ((!((double)value > 0.5)) ? "Chain" : "Rope"); GameObject gameObject = GameObject.Find(text); Rope component = gameObject.GetComponent(); component.breakRope(Random.value); } } }