// Update is called once per frame void Update() { if (!doMove) { return; } if (NInput.TouchBegan()) { Joystick.SetPivot(); PlayerPos = Player.localPosition; } if (NInput.TouchEnded()) { } if (NInput.IsScreenTouched()) { Speed += Time.deltaTime * Acceleration; Joystick.Update(); } else { Speed -= Time.deltaTime * Acceleration * 2f; } Speed = Mathf.Clamp(Speed, MinSpeed, !IsInFastLane() ? MaxSpeed : MaxSpeed + FewerBoost); Dist += Time.deltaTime * Speed; if (Dist >= Track.length) { dist = 30f; } SetPositionOnDistance(); if (isFewer) { Trail.emitting = true; if (Time.time > NextSpeedUp) { FewerBoost += 10f; Speed += 10f; NextSpeedUp = Time.time + 2f; } } else { FewerBoost = 20f; Trail.emitting = false; } }
private void Update() { if (NInput.TouchBegan()) { Joystick.SetPivot(); PlayerPos = Rb.position; Input = true; } CarManager.CountFlips(); if (NInput.TouchEnded()) { Input = false; } UIManager.Progress(transform.position.z / LevelGenerator.path.end.z); }