コード例 #1
0
    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();
    }
コード例 #2
0
    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();
    }
コード例 #3
0
 public void SetTargetVolume(float targetVolume)
 {
     fadeListener.SetTargetVolume(targetVolume);
 }