void Awake() { if (!CameraFader.Instance) { GameObject go = new GameObject(); go.name = "CameraFader"; go.AddComponent <CameraFader>(); } if (GameObject.FindGameObjectWithTag("Listener") != null) { fadeListener = GameObject.FindGameObjectWithTag("Listener").GetComponent <FadeListener>(); } }
public void StopMovie() { if (fadeListener == null) { fadeListener = GameObject.FindGameObjectWithTag("Listener").GetComponent <FadeListener>(); } Debug.Log("STOP MOVIE!!!!"); subtitles.OnSubtitleStop(); videoPlayer.Stop(); movieIsStarted = false; Time.timeScale = 1; endFunction(); fadeInFadeOut.SetToBlack(); fadeListener.OnFadeListener(0); fadeListener.SetTargetVolume(1.0f); Destroy(transform.root.gameObject); }
public void StopMovie() { if (fadeListener == null) { fadeListener = GameObject.FindGameObjectWithTag("Listener").GetComponent <FadeListener>(); } fadeListener.OnFadeListener(0); Debug.Log("STOP MOVIE!!!!"); videoPlayer.Stop(); GetComponent <AudioSource>().Stop(); movieIsStarted = false; Time.timeScale = 1; endFunction(); fadeInFadeOut.SetToBlack(); playerNotifications.DetachListener(listenerHandle); listenerHandle = null; Destroy(transform.root.gameObject); }
public void PlayMovie(AvatarToPlayerNotifications playerNotification, VideoClip videoClip, MovieEnd function) { if (fadeListener == null) { fadeListener = GameObject.FindGameObjectWithTag("Listener").GetComponent <FadeListener>(); } fadeListener.SetTargetVolume(0); fadeListener.OnFadeListener(0); playerNotifications = playerNotification; listenerHandle = playerNotifications.AttachListener(transform); videoPlayer = gameObject.AddComponent <VideoPlayer>(); videoPlayer.clip = videoClip; videoPlayer.targetTexture = renderTexture; videoPlayer.Play(); Debug.Log("Play Movie:" + videoPlayer.name); endFunction = function; waitingForPlay = true; Time.timeScale = 0; fadeInFadeOut.SetToBlack(); }
public void PlayMovie(VideoClip videoClip, MovieEnd function) { if (fadeListener == null) { fadeListener = GameObject.FindGameObjectWithTag("Listener").GetComponent <FadeListener>(); } var subtitlesPath = $"Subtitles/{videoClip.name}.sv"; Debug.Log($"loading subtitles from resource '{subtitlesPath}'"); var textAsset = Resources.Load(subtitlesPath) as TextAsset; if (textAsset == null) { Debug.LogError($"missing subtitles text, should have been here '{subtitlesPath}'"); } Debug.Log($"found text:{textAsset.text}"); var subtitlesObject = GameObject.Find("Subtitles"); Debug.Log($"Found gameobject {subtitlesObject.name}"); subtitles = subtitlesObject.GetComponent <Subtitles>(); subtitles.OnSubtitleStart(textAsset.text); fadeListener.SetTargetVolume(0); fadeListener.OnFadeListener(0); videoPlayer.clip = videoClip; videoPlayer.Play(); Debug.Log("Play Movie:" + videoPlayer.name); endFunction = function; waitingForPlay = true; Time.timeScale = 0; fadeInFadeOut.SetToTransparent(); // SetToBlack(); }