Exemplo n.º 1
0
 /// <summary>
 /// Sets up audio files for quicker shorter hints that are NOT spatialized
 /// </summary>
 private void SetupNonSpatialHintAudio()
 {
     if (oldHintLen != HintLength.nonspatial)
     {
         var middleAudioSources = transform.Find("Guide Line").GetComponents <AudioSource>();
         startLeftAudio      = middleAudioSources[4];
         startCenterAudio    = middleAudioSources[6];
         startRightAudio     = middleAudioSources[8];
         endFarLeftAudio     = middleAudioSources[4];
         endCenterLeftAudio  = middleAudioSources[5];
         endCenterAudio      = middleAudioSources[6];
         endCenterRightAudio = middleAudioSources[7];
         endFarRightAudio    = middleAudioSources[8];
         andIsAudio          = middleAudioSources[3];
     }
     oldHintLen = HintLength.nonspatial;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Sets up audio file for quicker and shorter hints that are spatialized
 /// </summary>
 private void SetupShortLenHintAudio()
 {
     if (oldHintLen != HintLength.shortLen)
     {
         startLeftAudio   = transform.Find("Start1").GetComponents <AudioSource>()[1];
         startCenterAudio = transform.Find("Start2").GetComponents <AudioSource>()[1];
         startRightAudio  = transform.Find("Start3").GetComponents <AudioSource>()[1];
         var farLeftAudioSources = transform.Find("End1").GetComponents <AudioSource>();
         endFarLeftAudio    = farLeftAudioSources[3];
         endCenterLeftAudio = transform.Find("End2").GetComponent <AudioSource>();
         var centerAudioSources = transform.Find("End3").GetComponents <AudioSource>();
         endCenterAudio      = centerAudioSources[0];
         endCenterRightAudio = transform.Find("End4").GetComponent <AudioSource>();
         var farRightAudioSources = transform.Find("End5").GetComponents <AudioSource>();
         endFarRightAudio = farRightAudioSources[3];
         var middleAudioSources = transform.Find("Guide Line").GetComponents <AudioSource>();
         andIsAudio = middleAudioSources[3];
     }
     oldHintLen = HintLength.shortLen;
 }
Exemplo n.º 3
0
    /// <summary>
    /// Announces the ball postion when a new ball is created
    /// </summary>
    /// <param name="hintLength"></param>
    /// <returns></returns>
    private IEnumerator AnnounceBallPos(HintLength hintLength)
    {
        if (hintLength == HintLength.full)
        {
            SetupFullHintAudio();
        }
        else if (hintLength == HintLength.shortLen)
        {
            SetupShortLenHintAudio();
        }
        else if (hintLength == HintLength.nonspatial)
        {
            SetupNonSpatialHintAudio();
        }
        //Play where the ball is starting
        if (_currBallPath.BallOriginType == BallOriginType.left) //Left Start
        {
            startLeftAudio.Play();
            yield return(new WaitForSeconds(startLeftAudio.clip.length));
        }
        else if (_currBallPath.BallOriginType == BallOriginType.center) //Center Start
        {
            startCenterAudio.Play();
            yield return(new WaitForSeconds(startCenterAudio.clip.length));
        }
        else if (_currBallPath.BallOriginType == BallOriginType.right) //Right Start
        {
            startRightAudio.Play();
            yield return(new WaitForSeconds(startRightAudio.clip.length));
        }

        //Play And Is Going to
        if (!canPressStartButton && playerReady)
        { //Check again to not send ball in transition.
            andIsAudio.Play();
            yield return(new WaitForSeconds(andIsAudio.clip.length));
        }
        else
        {
            yield break;
        }

        //Play the destination
        if (!canPressStartButton && playerReady)
        { //Check again to not send ball in transition.
            if (_currBallPath.BallDestType == BallDestType.farLeft)
            {
                endFarLeftAudio.Play();
                yield return(new WaitForSeconds(endFarLeftAudio.clip.length));
            }
            else if (_currBallPath.BallDestType == BallDestType.centerLeft)
            {
                endCenterLeftAudio.Play();
                yield return(new WaitForSeconds(endCenterLeftAudio.clip.length));
            }
            else if (_currBallPath.BallDestType == BallDestType.center)
            {
                endCenterAudio.Play();
                yield return(new WaitForSeconds(endCenterAudio.clip.length));
            }
            else if (_currBallPath.BallDestType == BallDestType.centerRight)
            {
                endCenterRightAudio.Play();
                yield return(new WaitForSeconds(endCenterRightAudio.clip.length));
            }
            else if (_currBallPath.BallDestType == BallDestType.farRight)
            {
                endFarRightAudio.Play();
                yield return(new WaitForSeconds(endFarRightAudio.clip.length));
            }
        }
        else
        {
            yield break;
        }
    }