// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space) && isOnGround && !gameOver) { playerRb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse); isOnGround = false; playerAnim.SetTrigger("Jump_trig"); dirtParticle.Stop(); playerAudio.PlayOneShot(jumpSound, 1.0f); moveLeft.UpdateScore(1); } }
// Start is called before the first frame update void Start() { moveLeft = GameObject.Find("Background").GetComponent <MoveLeft>(); moveLeft.UpdateScore(0); }