PlayVoice() public method

public PlayVoice ( string voiceClip ) : void
voiceClip string
return void
Example #1
0
    void Update()
    {
        float xNegPosition = transform.position.x - clickOffsetX;
        float xPosPosition = transform.position.x + clickOffsetX;
        float yPosPosition = transform.position.y + clickOffsetY;
        float yNegPosition = transform.position.y - clickOffsetY;

        // get position of click
        clickPosition.x = Camera.main.ScreenToWorldPoint(Input.mousePosition).x;
        clickPosition.y = Camera.main.ScreenToWorldPoint(Input.mousePosition).y;

        if (((yNegPosition < clickPosition.y && clickPosition.y < yPosPosition) &&
             (xNegPosition < clickPosition.x && clickPosition.x < xPosPosition)) && Input.GetMouseButtonDown(0))
        {
            if (!textActive)
            {
                // Moves the itemTextPanel to above the player
                moveTextPanel();

                itemTextPanel.SetActive(true);
                player.normalSpeed = 0f;
                textActive         = true;
                audioHandler.PlayVoice(dialogueToPlay);
            }
            else if (textActive)
            {
                itemTextPanel.SetActive(false);
                player.normalSpeed = player.defaultSpeed;
                textActive         = false;
            }
        }
        else if (Input.GetMouseButtonDown(0))
        {
            if (textActive)
            {
                itemTextPanel.SetActive(false);
                player.normalSpeed = player.defaultSpeed;
                textActive         = false;
            }
        }
    }
Example #2
0
    void Update()
    {
        //if player is overlapping item
        if (playerTouching == true)
        {
            float xNegPosition = transform.position.x - clickOffsetX;
            float xPosPosition = transform.position.x + clickOffsetX;
            float yPosPosition = transform.position.y + clickOffsetY;
            float yNegPosition = transform.position.y - clickOffsetY;

            ///get position of click
            clickPosition.x = Camera.main.ScreenToWorldPoint(Input.mousePosition).x;
            clickPosition.y = Camera.main.ScreenToWorldPoint(Input.mousePosition).y;

            if (Input.GetKeyDown(KeyCode.Space) || ((yNegPosition < clickPosition.y && clickPosition.y < yPosPosition) &&
                                                    (xNegPosition < clickPosition.x && clickPosition.x < xPosPosition) && Input.GetMouseButtonDown(0)))
            {
                fadingDarkness = playerScript.fadingDarknessScript;
                if (textActive == true)
                {
                    Time.timeScale = 1;
                    pause.busy     = false;
                    playerScript.AddPoints(itemAdd); //will add the amount in player script
                    Destroy(gameObject);             //destroys the object
                }
                else
                {
                    itemTextPanel.SetActive(true);
                    pause.busy = true;
                    flash      = true;
                    textActive = true;
                    if (dialogueToPlay != null)
                    {
                        audioHandler.PlayVoice(dialogueToPlay);
                    }
                    Time.timeScale = 0;
                }
                if (fadingDarkness == null)
                {
                    Debug.Log("not found");
                }
                else
                {
                    fadingDarkness.flash = true;
                }
            }
        }
    }
Example #3
0
 void Update()
 {
     if (this.transform.position.x < endPos.x)
     {
         transform.Translate(new Vector3(Time.deltaTime * speed, 0, 0));
     }
     else
     {
         if ((Application.loadedLevelName == "Ending Level" || Application.loadedLevelName == "Nightmare") && goodnight == false)
         {
             goodnight = true;
             audioHandler.PlayVoice("dialogue_goodnightwhisper_4");
             player.normalSpeed = player.defaultSpeed;
         }
     }
 }
Example #4
0
    //The cutscene
    IEnumerator _BeatGame()
    {
        //Make it true so the player can't spam space and glitch the cutscene
        cutsceneActivated = true;
        lightBulb.SetActive(true);
        glow.emissionRate  = 0;
        glow.startLifetime = 0;

        //Make it so the hunter's linecast won't trigger it to run fast or make the player lose the game if there is a collision
        player.GetComponent <PlayerControl> ().hide = true;

        Debug.Log("You beat the game!");
        darknessImage.alpha = 0;
        //Make it so player can't move
        player.GetComponent <PlayerControl> ().normalSpeed = 0;
        //Disable the final level cutscene script so the hunter can stay active
        finalLevelCutscene.enabled = false;
        //Activate the silhoutte
        //silhouette.SetActive (true);
        //Activate the hunter
        hunterEnemy.SetActive(true);
        player.GetComponent <Animator>().SetBool("Walking", false);
        //Correctly position the hunter
        hunterEnemy.transform.position = new Vector3(player.transform.position.x - 20, player.transform.position.y + 10, player.transform.position.z);
        //While the hunter is visible
        //
        hunterFog.SetActive(false);
        yield return(new WaitForSeconds(5f));

        hunterEnemy.GetComponent <CutsceneHunter>().StopSpeed();
        hunterEnemy.GetComponent <CutsceneHunter>().anim.SetBool("End", true);
        yield return(new WaitForSeconds(1f));

        audioHandler.PlayVoice(null);
        yield return(new WaitForSeconds(2f));

        hunterEnemy.SetActive(false);


        //Make the hunter inactive

        //Reset the fadingAlpha
        fadingAlpha = 1;
        //Wait 2 seconds
        yield return(new WaitForSeconds(2f));

        //While the silhouette is visisble

        /*
         *      while (silhouette.GetComponent<Renderer>().material.color.a >= 0f)
         *      {
         *              //Make things fade
         *              fadingAlpha -= Time.deltaTime*fadingSpeed;
         *              //Make the silhouette disappear
         *              silhouette.GetComponent<Renderer>().material.color  = new Color(1,1,1,fadingAlpha);
         *              //When the silhouette is partially invisible
         *              if(silhouette.GetComponent<Renderer>().material.color.a <= 0.40f)
         *              {
         *                      //Start whiting out the screen
         *                      whiteOutImage.alpha += Time.deltaTime*fadingSpeed;
         *              }
         *
         *              yield return null;
         *      }
         */
        //Finish whiting out the screen

        while (whiteOutImage.alpha < 1f)
        {
            whiteOutImage.alpha += Time.deltaTime * fadingSpeed;
            yield return(null);
        }
        //Wait 1 second
        yield return(new WaitForSeconds(1f));

        //Load the credits scene
        Application.LoadLevel("EndCreditsScene");
        yield return(null);
    }
Example #5
0
    IEnumerator _Cutscene()
    {
        //how long to wait until cutscene begins
        if (Application.loadedLevelName == "Tutorial Stage")
        {
            yield return(new WaitForSeconds(1.5f));

            audioHandler.PlayVoice("dialogue_goodnight_1");
            yield return(new WaitForSeconds(3f));
        }
        else
        {
            yield return(new WaitForSeconds(1.5f));

            if (Application.loadedLevelName == "Ending Level")
            {
                //do nothing
                // audioHandler.PlayVoice(17);
            }
            else
            {
                audioHandler.PlayVoice("dialogue_goodnightwhisper_1");
            }
            yield return(new WaitForSeconds(3f));
        }

        // Lock the camera once it finishes positioning itself
        cam.GetComponent <CameraFollowScript> ().enabled = false;
        audioHandler.LoopMusic(false);
        audioHandler.PlayMusic(3);
        yield return(new WaitForSeconds(1));

        // Pan camera to left until it hits the wall
        while (cam.transform.position.x > wallMargin)
        {
            cam.transform.position += new Vector3(-0.2f, 0, 0);
            yield return(null);
        }

        yield return(new WaitForSeconds(1));

        // move the hunter
        hunterEnemy.SetActive(true);

        yield return(new WaitForSeconds(1.5f));

        // pan back to player
        while (cam.transform.position.x < player.transform.position.x)
        {
            cam.transform.position += new Vector3(0.4f, 0, 0);
            yield return(null);
        }
        cam.GetComponent <CameraFollowScript> ().enabled = true;
        //prevent player from moving until end of cutscene
        playerScript.normalSpeed = playerScript.defaultSpeed;
        pause.busy = false;
        audioHandler.LoopMusic(true);
        audioHandler.PlayMusic(5);
        //yield return new WaitForSeconds(10f);
        // hunterEnemy.SetActive(false);
        yield return(null);
    }