public void Restart() { pause = false; diskCtrl.SetPosition(diskStartPosition); diskCtrl.SetRotation(Vector3.zero); diskCtrl.SetAngularVelocity(Vector3.zero); manualDiskCtrl.SetManualControl(false); manualBallCtrl.SetManualControl(false); ballCtrl.SetPosition(ballStartPosition); ballCtrl.SetRotation(Vector3.zero); ballCtrl.SetVelocity(Vector3.zero); ballCtrl.SetAngularVelocity(Vector3.zero); ball.GetComponent <TrailRenderer>().Clear(); }
void Update() { if (enabledControl && (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0)) { ballCtrl.SetVelocity(new Vector3( Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0) * multiplier); } else { } if (Input.GetKeyDown(KeyCode.N)) { enabledControl = !enabledControl; } }