private void Update() { if (Input.GetKeyDown(KeyCode.Space) || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)) { if (charStatus == Status.OnPlatform) { this.GetComponent <AudioSource>().clip = JumpClips[Random.Range(0, JumpClips.Count - 1)]; this.GetComponent <AudioSource>().Play(); currentPlatformCollider.enabled = false; charAttemptedStop = false; charStatus = Status.Falling; platformTargetJoints.ForEach(j => Destroy(j)); platformTargetJoints.Clear(); foreach (var rb in CharacterRbs) { rb.AddForce(new Vector2(0, jumpForce)); } FixHands(); } else if (charStatus == Status.Falling && !charAttemptedStop) { SetVelocitiesToZero(CharacterRbs); ReleaseHands(); charAttemptedStop = true; } } if (charStatus == Status.OnPlatform) { ReleaseHands(); HandRbs.ForEach(rb => rb.MovePosition(new Vector3(ropeHandsXCoord, rb.transform.position.y))); } var speed = GetComponent <Rigidbody2D>().velocity.magnitude; speedText.text = Mathf.Round(speed) / 10 + " m / s"; if (charStatus != Status.Dead && !charAttemptedStop) { if (speed < CalmSpeed) { faceController.SetCalm(); } else if (speed < PanicSpeed) { faceController.SetLessCalm(); } else { faceController.SetPanicked(); } } if (charStatus == Status.Falling && health > 0) { health -= Time.deltaTime; SetHealth(health); } }