PlayMusic() public method

public PlayMusic ( int i ) : void
i int
return void
Example #1
0
    public IEnumerator levelMusic()
    {
        ///wait for length of intro
        // if(Application.loadedLevelName != "Ending Level" && Application.loadedLevelName != "Nightmare")
        yield return(new WaitForSeconds(waitTime));

        //play and loop level music
        audioHandler.LoopMusic(true);
        audioHandler.PlayMusic(5);
        yield return(null);
    }
Example #2
0
    void Start()
    {
        // Unfreezes time in case somebody forgets to do it (thanks pause screen)
        Time.timeScale = 1f;
        //create or reset the playerpref for level jumping
        PlayerPrefs.SetInt("NextLevel", 3);

        // Makes sure the sprites appear correct
        const int scrnHeight = 720;
        const int ppu        = 100;

        FindObjectOfType <Camera>().orthographicSize = (scrnHeight / 2.0f) / ppu;

        //play title music
        audioHandler.LoopMusic(true);
        //music 0 is Lullaby Waltz (title music)
        audioHandler.PlayMusic(0);

        // The settings management code are in their respective screens.
        // These screens start out inactive; their initialization needs to be manually called.
        // Awake() and Start() won't be called if an object starts out inactive.
        scrnBrightness.InitSettings();
        scrnAudio.InitSettings();

        StartCoroutine(_FadeIn());
    }
Example #3
0
 void Start()
 {
     skipButton.gameObject.SetActive(false);
     audioHandler = GameObject.Find("AudioHandler").GetComponent <AudioHandlerScript>();
     audioHandler.LoopMusic(false);
     //play credits music
     audioHandler.PlayMusic(2);
     StartCoroutine(JumpToStart());
 }
 void Start()
 {
     skipButton.gameObject.SetActive(false);
     audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandlerScript>();
     audioHandler.LoopMusic(false);
     //play credits music
     audioHandler.PlayMusic(2);
     StartCoroutine(JumpToStart());
 }
Example #5
0
    //The cutsccene
    IEnumerator _Cutscene()
    {
        pause.busy = true;
        playerScript.normalSpeed = 0f;
        audioHandler.LoopMusic(false);
        audioHandler.PlayMusic(3);
        yield return(new WaitForSeconds(0.5f));

        // Lock the camera once it finishes positioning itself
        cam.GetComponent <CameraFollowScript> ().enabled = false;

        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
        hunterEnemy.GetComponent <Hunter>().SetSpeed();
        playerScript.defaultSpeed = defaultSpeedTemp;
        playerScript.normalSpeed  = playerScript.defaultSpeed;
        pause.busy = false;
        //doorScript.enabled = true;
        yield return(null);
    }
Example #6
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);
    }