Example #1
0
    IEnumerator TitleCR()
    {
        yield return(new WaitForSeconds(1.0f));

        float t = Time.time;

        while (((Time.time - t) < 2.0f) && (!Input.anyKeyDown))
        {
            yield return(null);
        }

        while (Input.anyKeyDown)
        {
            yield return(null);
        }

        float alpha = titleCanvasGroup.alpha;

        while (alpha > 0.1f)
        {
            alpha -= Time.deltaTime;

            titleCanvasGroup.alpha = alpha;

            yield return(null);
        }

        float y = textRT.anchoredPosition.y;

        while ((y < 1500.0f) && (!Input.anyKeyDown))
        {
            y += Time.deltaTime * 50.0f;

            textRT.anchoredPosition = new Vector2(textRT.anchoredPosition.x, y);

            yield return(null);
        }

        FullscreenFader.FadeOut(2.0f);

        yield return(new WaitForSeconds(2.0f));

        SceneManager.LoadScene(startLevel);
    }
Example #2
0
    IEnumerator EnterCR(PlayerController player)
    {
        if (successSound)
        {
            successSound.Play();
        }

        player.EnableMovement(false);
        player.GetComponent <Backpack>().enabled = false;

        player.Celebrate();

        yield return(new WaitForSeconds(1.0f));

        FullscreenFader.FadeOut(1.0f);

        yield return(new WaitForSeconds(1.5f));

        SceneManager.LoadScene(targetScene);
    }
Example #3
0
    IEnumerator RunCutsceneCR()
    {
        PlayerController pc = FindObjectOfType <PlayerController>();

        commander.SetBool("Grounded", true);
        pc.enableControls = false;

        yield return(new WaitForSeconds(1.0f));

        pc.enabled = false;

        Animator playerAnim = pc.GetComponent <Animator>();

        playerAnim.SetFloat("AbsSpeedX", pc.moveSpeed);

        Destroy(pc.GetComponent <HealthSystem>());

        while (playerAnim.transform.position.x < targetPos.position.x)
        {
            playerAnim.transform.position = Vector3.MoveTowards(playerAnim.transform.position, targetPos.position, pc.moveSpeed * Time.deltaTime);

            yield return(null);
        }

        playerAnim.SetFloat("AbsSpeedX", 0.0f);

        yield return(new WaitForSeconds(1.0f));

        commander.SetTrigger("Celebrate");
        commander.speed = 0.1f;

        levelManager.DisplayText("Congratulation, agent!");
        while (levelManager.textEnabled)
        {
            yield return(null);
        }

        levelManager.DisplayText("You are ready to join these men and women in the field, fighting for our Universe's salvation!");
        while (levelManager.textEnabled)
        {
            yield return(null);
        }

        levelManager.DisplayText("Now, just let me...");
        while (levelManager.textEnabled)
        {
            yield return(null);
        }

        StartCoroutine(AlarmCR());
        alarmSound.Play();
        crowdSound.Stop();

        yield return(new WaitForSeconds(1.0f));

        levelManager.DisplayText("What's this? An alarm? Impossible!");
        while (levelManager.textEnabled)
        {
            yield return(null);
        }

        for (int i = 0; i < 3; i++)
        {
            CameraShake2d.Shake(1.0f * (i + 1), 0.5f);
            explosionSound.volume = 0.2f * (i + 1);
            explosionSound.Play();

            yield return(new WaitForSeconds(0.75f));
        }

        levelManager.DisplayText("What...");
        while (levelManager.textEnabled)
        {
            yield return(null);
        }

        for (int i = 0; i < explosionPoints.Length; i++)
        {
            yield return(new WaitForSeconds(0.5f));

            CameraShake2d.Shake(2.0f, 0.5f);
            explosionSound.volume = 0.8f;
            explosionSound.Play();

            Instantiate(explosionPrefab, explosionPoints[i].position, explosionPoints[i].rotation);
        }

        FullscreenFader.FadeOut(0.6f, Color.white);

        yield return(new WaitForSeconds(3.0f));

        SceneManager.LoadScene("RealGame");
    }