private void Update() { isGround = Physics2D.Linecast(transform.position, groundCheck.position, 1 << LayerMask.NameToLayer("Ground")); playerScore = transform.position.x / 2; StartCoroutine(updateUI()); playerVelocity.x = Input.GetAxis("Horizontal") * playerSpeed * Time.deltaTime; if (Input.GetKey(KeyCode.Escape)) { _uiManager.ExitGame(); } if ((Input.GetKey(KeyCode.W)) && (isGround)) { playerVelocity.y = jumpHeight; isGround = false; } else { playerVelocity.y = GetComponent <Rigidbody2D>().velocity.y; } playerVelocity.x = playerSpeed; }