void Update() { _cam.backgroundColor = Color.HSVToRGB( Mathf.Repeat(0.5f + ProgressiveRandom.Value(0.5f, 0.2f), 1f), Mathf.Repeat(0.5f * ProgressiveRandom.Value(0.5f, 0.2f), 1f), Mathf.Min(1f, 0.1f + .03f * GameLogic.Instance.LevelTime)); }
void LateUpdate() { if (GameLogic.Instance.State != GameLogic.GameState.Running) { return; } // interpolate towards target position var targetPos = _subject.transform.position + _offset; transform.position = Vector3.Lerp(transform.position, targetPos, _lerpAmount * 60f * Time.deltaTime); // lookahead down the track transform.LookAt(_subject.position + Vector3.right * _lookAhead); // roll the camera based on random value float rollValue = 30f * ProgressiveRandom.Value(0.9f, 0.1f); transform.rotation *= Quaternion.AngleAxis(rollValue, Vector3.forward); }