Beispiel #1
0
 public void Play(SOUNDTYPE soundtype)
 {
     if ((int)soundtype < clips.Length)
     {
         source.Stop();
         source.PlayOneShot(clips[(int)soundtype]);
     }
 }
Beispiel #2
0
 //コンストラクタ(ファイルパスを受け取る)
 public SoundPlayer(string filePath, SOUNDTYPE st)
 {
     s           = Director.SoundCache.GetSound(filePath);
     soundHandle = s.Gh;
     ChangePan(0);      // パンの初期値は0
     ChangeVolume(255); // ボリュームは最大値
     soundType = st;    // BGMか否か
     Playtype  = PLAYTYPE.BACK;
     if (soundType != SOUNDTYPE.SE)
     {
         Playtype = PLAYTYPE.LOOP;
     }
 }
Beispiel #3
0
    public void SetVolume(SOUNDTYPE _Type, float _Vol)
    {
        GameObject[] list = GameObject.FindGameObjectsWithTag(m_TagName[(int)_Type]);

        foreach (GameObject Obj in list)
        {
            AudioSource Audio = Obj.GetComponent <AudioSource>();

            if (Audio != null)
            {
                Audio.volume = _Vol;
            }
        }
    }
Beispiel #4
0
    //  볼륨 설정하기
    public void SetVolume(SOUNDTYPE _Type, float _Volume)
    {
        m_Volume[(int)_Type] = Mathf.Clamp(_Volume, 0, 1);

        foreach (GameObject _obj in m_ControlList[(int)_Type])
        {
            AudioSource Audio = _obj.GetComponent <AudioSource>();
            Audio.volume = m_Volume[(int)_Type];
        }

        //  UGUI 용 설정
        if (m_Slider[(int)_Type] != null)
        {
            m_Slider[(int)_Type].value = m_Volume[(int)_Type];
        }
    }
Beispiel #5
0
 //  현재 볼륨 얻기
 public float GetVolume(SOUNDTYPE _Type)
 {
     return(m_Volume[(int)_Type]);
 }
Beispiel #6
0
 //  관리 객체 제거하기
 public void RemoveObject(SOUNDTYPE _Type, GameObject _Obj)
 {
     m_ControlList[(int)_Type].Remove(_Obj);
 }
Beispiel #7
0
 //  관리 객체 추가하기
 public void AddObject(SOUNDTYPE _Type, GameObject _Obj)
 {
     m_ControlList[(int)_Type].Add(_Obj);
 }