private void Update() { ParallaxBackground.Speed = MovementSpeed; Wheels.ForEach(t => t.Rotate(-Vector3.forward, 2 * Mathf.PI * WheelSpeedMultiplier * MovementSpeed * Time.deltaTime)); float diminisher = 1f; if (_score > 0) { diminisher = Mathf.Clamp(1f - (_score * 0.1f), .6f, 1f); } TravelDistance += Time.deltaTime * MovementSpeed * diminisher; if (!_stopped) { if (TravelDistance > GateDistanceThreshold && TravelDistance % GateDistanceThreshold < 1f) { TravelDistance += 1f; _stoppedCount++; if (PuzzleController.ValidatePuzzle()) { Gate.Appear(true); MovementSpeed += MovementSpeedBoost; _score++; Score.UpdateScore(_score); DelayedCall(() => { PuzzleController.CreateNewPuzzle(); PuzzleController.ToggleInput(true); }, 2f); } else { StopDraisine(); _score = 0; Score.UpdateScore(_score); } } MovementSpeed += Time.deltaTime / MovementSpeedIncreaseDivider; } else { if (PuzzleController.ValidatePuzzle()) { Gate.Toggle(true); if (!_newPuzzle) { Draisine.StartMovement(); _newPuzzle = true; TravelDistance = TravelDistance - TravelDistance % GateDistanceThreshold + 2f; DelayedCall(() => { PuzzleController.CreateNewPuzzle(); _newPuzzle = false; PuzzleController.ToggleInput(true); }, 2f); } } } _modulo = TravelDistance % GateDistanceThreshold; }