Ejemplo n.º 1
0
    private IEnumerator LoadAsynchronously(int sceneIndex)
    {
        hint.text = hints.GetNextHint();
        loadingCanvas.gameObject.SetActive(true);

        float now = Time.time;

        while (!operation.isDone)
        {
            if ((now + hints.GetHintTime()) <= Time.time)
            {
                hint.text = hints.GetNextHint();
                now       = Time.time;
            }

            float progress = Mathf.Clamp01(operation.progress / .9f);

            progressText.text = ((int)(progress * 100)).ToString() + " %";
            slider.value      = progress;

            yield return(null);
        }
    }