Example #1
0
    private IEnumerator StageTransitionRoutine(Vector3 cameraTargetPosition, float time)
    {
        float   startTime     = Time.time;
        Vector3 startPosition = Camera.main.transform.position;
        float   ratio         = 0f;

        platformGenerator.StopMoving();

        stageTransitionSound.Play();

        do
        {
            ratio = Mathf.Clamp01((Time.time - startTime) / time);
            Camera.main.transform.position = Vector3.Lerp(startPosition, cameraTargetPosition, ratio);
            yield return(null);
        } while (ratio < 1f);

        platformGenerator.StartMoving();

        stageTransitionRoutine = default;

        yield return(null);
    }