Example #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.Space))
     {
         if (!videoPlayer.GetDirectAudioMute(0))
         {
             Debug.Log("music is on");
             videoPlayer.SetDirectAudioMute(0, true);
         }
         else if (videoPlayer.GetDirectAudioMute(0))
         {
             videoPlayer.SetDirectAudioMute(0, false);
         }
     }
 }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.M))
     {
         vp.SetDirectAudioMute(0, !vp.GetDirectAudioMute(0));
     }
 }
Example #3
0
 public bool GetAudioMute(ushort trackIndex)
 {
     if (useAudioPlayer)
     {
         if (audioPlayer.audioOutputMode == VideoAudioOutputMode.Direct)
         {
             return(audioPlayer.GetDirectAudioMute(trackIndex));
         }
         else if (audioPlayer.audioOutputMode == VideoAudioOutputMode.AudioSource)
         {
             return(audioPlayer.GetTargetAudioSource(trackIndex).mute);
         }
     }
     else
     {
         if (videoPlayer.audioOutputMode == VideoAudioOutputMode.Direct)
         {
             return(videoPlayer.GetDirectAudioMute(trackIndex));
         }
         else if (videoPlayer.audioOutputMode == VideoAudioOutputMode.AudioSource)
         {
             return(videoPlayer.GetTargetAudioSource(trackIndex).mute);
         }
     }
     return(false);
 }
Example #4
0
 // Update is called once per frame
 void Update()
 {
     if (Input.anyKeyDown)
     {
         if (Input.GetKeyDown(KeyCode.M))
         {
             video.SetDirectAudioMute(0, !video.GetDirectAudioMute(0));
         }
         else
         {
             _end = true;
         }
     }
     if (_end)
     {
         FadeOut();
         if (_alpha <= 0f)
         {
             SceneManager.LoadScene("MainMenu");
         }
     }
     else
     if (video.isPrepared && !video.isPlaying)
     {
         video.Play();
     }
 }
Example #5
0
    /// <summary>
    /// Calculates the opacity for each images in the level depending upon the anetena position
    /// </summary>
    void calculateOpacity()
    {
        Vector2 antLeft  = antm.GetLeftPos();
        Vector2 antRight = antm.GetRightPos();

        Vector2 RDiff = rightPos - antRight;
        Vector2 LDiff = leftPos - antLeft;

        float totalRDiff  = Mathf.Abs(RDiff.x) + Mathf.Abs(RDiff.y);
        float totalLDiff  = Mathf.Abs(LDiff.x) + Mathf.Abs(LDiff.y);
        float diffPercent = 0;

        Debug.Log("Total R Diff: " + totalRDiff);
        Debug.Log("Total L Diff: " + totalLDiff);

        if (totalRDiff <= 1.0f)
        {
            diffPercent += (1.0f - totalRDiff) * 0.5f;
        }
        if (totalLDiff <= 1.0f)
        {
            diffPercent += (1.0f - totalLDiff) * 0.5f;
        }

        if (diffPercent > 0.0f)
        {
            diffPercent += 0.25f;
            diffPercent  = Mathf.Clamp(diffPercent, 0, 1.0f);
        }

        if (video)
        {
            vidp.targetCameraAlpha = diffPercent;
            if (vidp.GetDirectAudioMute(0))
            {
                vidp.SetDirectAudioVolume(0, diffPercent);
            }
            else
            {
                vidp.GetComponent <AudioSource>().volume = diffPercent;
            }
        }
        else
        {
            Color newCol = img.color;
            newCol.a  = diffPercent;
            img.color = newCol;
        }

        // reduces noise to make image visible
        if (diffPercent < 1.0f)
        {
            stat.GetComponent <AudioSource>().volume = 1.0f - diffPercent;
        }
    }
    void Start()
    {
        Assert.IsNotNull(image);
        Assert.IsNotNull(soundOnSprite);
        Assert.IsNotNull(soundOffSprite);
        Assert.IsNotNull(videoPlayer);

        isMuted = Enumerable.Range(0, videoPlayer.audioTrackCount)
                  .Any(i => videoPlayer.GetDirectAudioMute((ushort)i));
        SetMuted(isMuted);
    }
 // Gets the audio mute status for the specified track.
 public bool IsAudioMute(ushort track)
 {
     if (videoPlayer.audioOutputMode == VideoAudioOutputMode.Direct)
     {
         return(videoPlayer.GetDirectAudioMute(track));
     }
     else if (videoPlayer.audioOutputMode == VideoAudioOutputMode.AudioSource)
     {
         return(videoPlayer.GetTargetAudioSource(track).mute);
     }
     return(false);
 }