Beispiel #1
0
    /// <summary>
    /// SEを再生するが、編集可能
    /// </summary>
    /// <param name="type">SEの内容</param>
    /// <returns>再生されているSE</returns>
    public static AudioSource Play(SEType type)
    {
        AudioSource src = new GameObject("[Audio SE - " + type.ToString() + " - Editable]").AddComponent <AudioSource>();

        src.transform.SetParent(myManager.transform);
        src.clip = SEclips[(int)type];
        src.outputAudioMixerGroup = mixerGroups[0];
        src.Play();

        return(src);
    }
Beispiel #2
0
    public AudioSource PlaySE(SEType type, bool isLoop = false)
    {
        AudioSource se = new GameObject(type.ToString()).AddComponent <AudioSource>();

        se.clip = SEList[(int)type];
        se.gameObject.AddComponent <SEScript>();
        se.loop = isLoop;
        se.Play();

        return(se);
    }
Beispiel #3
0
    /// <summary>
    /// SEを再生する
    /// </summary>
    /// <param name="type">SEの内容</param>
    /// <param name="vol">音量</param>
    public static void Play(SEType type, float vol)
    {
        AudioSource src = new GameObject("[Audio SE - " + type.ToString() + "]").AddComponent <AudioSource>();

        src.transform.SetParent(myManager.transform);
        src.clip   = SEclips[(int)type];
        src.volume = vol;
        src.outputAudioMixerGroup = mixerGroups[0];
        src.Play();

        Destroy(src.gameObject, SEclips[(int)type].length + 0.1f);
    }
Beispiel #4
0
    AudioSource _Play(SEType type, float vol, bool autoDelete)
    {
        AudioSource src = new GameObject("[Audio SE - " + type.ToString() + "]").AddComponent <AudioSource>();

        src.transform.SetParent(myManager.transform);
        src.clip   = SEclips[(int)type];
        src.volume = vol;
        src.outputAudioMixerGroup = mixerGroups[0];
        src.Play();

        if (autoDelete)
        {
            Destroy(src.gameObject, SEclips[(int)type].length + 0.1f);
        }

        return(src);
    }