//this function is used to wait for a fade out before loading the main game from the main menu protected IEnumerator DelayFade(float delayTime) { //grab a reference to the Scene Effects script on the Cloud game object SceneEffects Effects = GameObject.Find("Cloud").GetComponent <SceneEffects> (); //set the fade speed Effects.fadeSpeed = 0.9f; //set the color of the fade to black Effects.screenColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); //initiate the fade out Effects.BeginFade(1); //wait for the fade to end yield return(new WaitForSeconds(delayTime)); //detstroy the sound manager SoundManager.Destroy(SoundManager.instance.gameObject); //load the Main Scene to start the game SceneManager.LoadScene("Main"); }
private void AddEffect(SceneEffects.SceneEffect effect) { if (sceneEffects.Count <= 0) effect.PlayThis = true; sceneEffects.Add(effect); }