// Update is called once per frame void Update() { moveDir = new Vector3(Input.GetAxisRaw("Horizontal"), 0, 0).normalized; jumpRestRemaining -= Time.deltaTime; if (moveDir.magnitude > 1) { moveDir = moveDir.normalized; } if (Physics.Raycast(transform.position, -transform.up, out hit)) { distToGround = hit.distance; Debug.DrawLine(transform.position, hit.point, Color.yellow); } if (Input.GetMouseButton(0) && distToGround < (characterHeight * .5f) && jumpRestRemaining < 0) { jumpRestRemaining = jumpRest; GetComponent <Rigidbody>().AddRelativeForce(Vector3.up * jumpSpeed * 100); } if (canMine && meteorPrefab) { if (Input.GetMouseButton(1)) { //particle system //add ore to player ore += 10f; meteorPrefab.oreAmount -= 10f; //destroy meteor } } if (meteorPrefab.oreAmount == 0f) { meteorPrefab.DestroyMeteor(); canMine = false; } }