private void Update() { //if the game is live if (gameMode.IsGameRunning()) { //if the user touches the screen if (Input.touchCount > 0 || Input.GetMouseButtonDown(0)) { //this is only here because I need the mouse down for testing in editor if (Input.touchCount > 0) { //if the touch hasnt just been pressed, aka is a hold... return Touch t = Input.touches[0]; if (t.phase != TouchPhase.Began) { return; } } //adds force to the player AddForce(Vector3.up, 3); //plays the player jumped sound. SoundManager.GetSoundManager()?.PlayPlayerJumped(); } } }
private void Update() { if (GM.IsGameRunning()) { transform.position += new Vector3(speed * Time.deltaTime, 0, 0); GM.AddDistanceTraveled(speed * Time.deltaTime); } }