Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class BumpyScene : MonoBehaviour {
- public bool isReady = false;
- public int Scene;
- public SoundManager sm;
- public bool SoundHasStarted = false;
- public ScreenFadeInOut sfio;
- private bool soundPlaying = false;
- private bool otherSoundPlayed = false;
- void Start ()
- {
- Screen.lockCursor = true; //locks cursor
- Screen.showCursor = false; //hides cursor
- sm = GetComponent<SoundManager>(); //gets sound manager
- GetComponent<ScreenFadeInOut>(); //calls ScreenFadeinOut script
- }
- void Update ()
- {
- if (sfio.Ready) //if the bool "Ready" in "ScreenFadeInOut" is true...
- {
- sm.PlaySound("DreamScene1"); //...play sound 1 and...
- otherSoundPlayed = true; //...set "otherSoundPlayed" to true.
- if (!soundPlaying && otherSoundPlayed) //if "soundPlaying" is false and "otherSoundPlayed" is true...
- {
- sm.PlaySound("DreamScene2"); //...play sound 2, and...
- whenDone(); //...call the "whenDone" function.
- }
- }
- }
- public void whenDone()
- {
- if (isReady) //when everything is done...
- {
- Application.LoadLevel(Scene); //...load the scene defined in the variable.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement