Пример #1
0
    void Update()
    {
        if (ShouldPlayerMove())
        {
            // Make the level progresses forward by the player's speed
            Vector3 currentDerivative = _levelTrackSpline.DerivativeAt(LevelProgression);
            LevelProgression += (Time.deltaTime * _playerScript.GetCurrentSpeed() / _levelTrackSpline.SpanCount) / currentDerivative.magnitude;

            _playerScript.MoveTo(_levelTrackSpline.ValueAt(LevelProgression));
        }
    }