Esempio n. 1
0
    /// <summary>
    /// 播放音效
    /// </summary>
    /// <param name="path"></param>
    /// <param name="audioType"></param>
    public static AudioObject PlayAudio(string path, Transform parent, AudioEnunType audioType, float volume = 1, bool loop = false)
    {
        AudioObject audio = default(AudioObject);

        switch (audioType)
        {
        case AudioEnunType.BGM:
            audio = bgmAudio.Play(path, parent, new AudioParamete()
            {
                volume = volume, loop = loop, audio3DValue = 0
            });
            break;

        case AudioEnunType.Effset:
            audio = effectAudio.Play(path, parent, new AudioParamete()
            {
                volume = volume, loop = loop, audio3DValue = 0
            });
            break;

        case AudioEnunType.Speech:
            audio = speechAudio.Play(path, parent, new AudioParamete()
            {
                volume = volume, loop = loop, audio3DValue = 0
            });
            break;

        default:
            break;
        }

        return(audio);
    }
Esempio n. 2
0
    IEnumerator CountStart()
    {
        yield return(new WaitForSeconds(0.5f));

        Countdown.GetComponent <Text>().text = "3";
        GetReady.Play();
        Countdown.SetActive(true);
        yield return(new WaitForSeconds(1));

        Countdown.SetActive(false);
        Countdown.GetComponent <Text>().text = "2";
        GetReady.Play();
        Countdown.SetActive(true);
        yield return(new WaitForSeconds(1));

        Countdown.SetActive(false);
        Countdown.GetComponent <Text>().text = "1";
        GetReady.Play();
        Countdown.SetActive(true);
        yield return(new WaitForSeconds(1));

        Countdown.SetActive(false);
        GoAudio.Play();
        BGMAudio.Play();
        LapTimer.enabled      = true;
        CarControls.enabled   = true;
        AICarControls.enabled = true;
    }