Пример #1
0
    IEnumerator StartEvent()
    {
        yield return(new WaitForSeconds(Random.Range(minTime, maxTime) / 2));

        while (true)
        {
            progress        = 0;
            light.intensity = 0;
            yield return(new WaitForSeconds(0.1f));

            light.intensity = initialIntensity;
            yield return(new WaitForSeconds(0.2f));

            light.intensity = 0;
            yield return(new WaitForSeconds(0.1f));

            light.intensity = initialIntensity;
            yield return(new WaitForSeconds(0.2f));

            light.intensity = 0;
            yield return(new WaitForSeconds(0.3f));

            light.intensity = initialIntensity / 2;
            yield return(new WaitForSeconds(0.4f));

            cameraCanvas.UpdatePowerLevel(0, true);
            light.intensity = 0;
            player.enabled  = false;
            nextState       = State.Vertical;
            if (!shownTutorial)
            {
                yield return(new WaitForSeconds(1.0f));

                cameraCanvas.DisplayMessage("The power went out!\nRotate the analog stick to crank the light back on.");
                shownTutorial = true;
            }
            yield return(new WaitUntil(() => progress >= 100));

            nextState = State.None;
            yield return(new WaitForSeconds(0.1f));

            light.intensity = initialIntensity / 2;
            yield return(new WaitForSeconds(0.2f));

            light.intensity = 0;
            yield return(new WaitForSeconds(0.1f));

            light.intensity = initialIntensity / 2;
            yield return(new WaitForSeconds(0.2f));

            light.intensity = 0;
            yield return(new WaitForSeconds(0.3f));

            light.intensity = initialIntensity;
            player.enabled  = true;
            yield return(new WaitForSeconds(Random.Range(minTime, maxTime)));
        }
    }