Exemplo n.º 1
0
    // when the player first finds the Fuser on the ground
    IEnumerator firstLookAtFuser()
    {
        Quaternion startingRotation = fuser.transform.rotation;
        Quaternion endingRotation   = startingRotation * Quaternion.Euler(0, 0, 90);
        float      lerpTime         = 1f;
        float      currentLerpTime  = 0f;

        //wait until player has closed the "You got the Fuser!" textbox
        while (!ConversationController.currentlyEnabled)
        {
            yield return(new WaitForFixedUpdate());
        }
        while (ConversationController.currentlyEnabled)
        {
            yield return(new WaitForFixedUpdate());
        }

        disablePlayerControl();

        screenFader.fadeOut(0.2f);

        while (Quaternion.Angle(fuser.transform.rotation, endingRotation) > 2)
        {
            fuser.transform.rotation = Quaternion.Lerp(startingRotation, endingRotation, currentLerpTime / lerpTime);
            currentLerpTime         += Time.deltaTime;
            yield return(new WaitForFixedUpdate());
        }

        yield return(new WaitForSeconds(1f));

        // set Fuser back to original position/rotation for next time it's used
        fuser.transform.rotation = startingRotation;

        //Booting up... animation
        lowPowerText.enabled = true;

        for (int i = 0; i < 3; i++)
        {
            lowPowerText.text = "Booting up.  ";
            yield return(new WaitForSeconds(0.25f));

            lowPowerText.text = "Booting up.. ";
            yield return(new WaitForSeconds(0.25f));

            lowPowerText.text = "Booting up...";
            audioSource.PlayOneShot(bootingUpSound);
            yield return(new WaitForSeconds(0.5f));

            lowPowerText.text = "Booting up   ";
        }
        lowPowerText.enabled = false;
        yield return(new WaitForSeconds(0.5f));

        //Warning: low power animation
        lowPowerText.enabled = true;
        lowPowerText.text    = "Welcome to the Fuser X7000 - the premier technology for constructing and crafting!";
        audioSource.PlayOneShot(powerUpSound);
        yield return(new WaitForSeconds(4f));

        lowPowerText.text = "Warning: low power! Please replace batteries.";
        audioSource.PlayOneShot(lowPowerSound);
        yield return(new WaitForSeconds(2f));

        //enable mouse cursor
        ConversationController.AllowMouse();
        putAwayButton.gameObject.SetActive(true);

        // then we continue when the player clicks the put away button
    }