예제 #1
0
    void PlayBGMSound(FishData playerData)
    {
        BGMData setBGMData = BGMData.Ingame;

        if (playerData.isTargetedByPredator)
        {
            setBGMData = BGMData.PredatorChase;
            //Debug.Log("Is targeted");
            UIGameController.Instance.ShowPanelPredatorRed();
            UIGameController.Instance.AnimatePredatorRed();
        }
        else if (playerData.isInPredatorRange == 1)         //octopus
        {
            setBGMData = BGMData.PredatorArea;
            //Debug.Log("In Predator range");
            UIGameController.Instance.ShowPanelPredatorRed();
        }
        else if (playerData.isInPredatorRange == 2)         //shark
        {
            setBGMData = BGMData.PredatorAreaShark;
            //Debug.Log("In Predator range");
            UIGameController.Instance.ShowPanelPredatorShark();
        }

        if (usedBGMData != setBGMData)
        {
            usedBGMData = setBGMData;
            SoundUtility.Instance.SetBGM(usedBGMData);
            UIGameController.Instance.HidePanelPredator();
        }
    }
예제 #2
0
 public void SetBGM(BGMData BGMType)
 {
     if (BGMSource != null)
     {
         BGMSource.clip = BGMClip[(int)BGMType - 1];
         BGMSource.Play();
         BGMSource.loop = true;
         BGMSource.mute = !EssentialData.Instance.LoadSettingBGM();
     }
 }
예제 #3
0
    public void PlayBGM(eBGM bgm, bool loop = true)
    {
        BGMData bgmData = BGM.Find(data => data.BGM == bgm);

        if (bgmData != null)
        {
            AudioSource_BGM.clip = bgmData.AudioClip;
            AudioSource_BGM.loop = loop;
            AudioSource_BGM.Play();
        }
    }
예제 #4
0
    public async Task PlayBGM(int bgmIndex)
    {
        BGMData data = await GetBGMData(bgmIndex);

        if (data == null)
        {
            return;
        }

        AudioManager.Instance.PlayBGM(data.BGM, true, data.RepeatTime, data.LoopStartTime).DoNotAwait();
    }
예제 #5
0
    // 音を切り替えて再生
    public void PlayBGM(string Key, float delay = 0.0f)
    {
        m_data = m_param.BGMs.GetByKey(Key);
        if (m_data == null)
        {
            Debug.LogAssertion(Key + " is NotFound");
            return;
        }

        if (m_bgmSource.clip != m_data.m_clip)
        {
            m_bgmSource.clip = m_data.m_clip;
        }

        PlayBGM(delay);
    }
예제 #6
0
 public void PlayBGM(string key)
 {
     if (key != CurrentBGMKey)
     {
         CurrentBGMKey = key;
         if (key == null || key == NoBGMKey)
         {
             bgmSource.Stop();
         }
         else
         {
             bgmSource.volume = 1.0f;
             var       db   = Global.Instance().Database;
             BGMData   data = db.BGM.GetData(key);
             AudioClip clip = data.track;
             bgmSource.clip = clip;
             bgmSource.Play();
         }
     }
 }
예제 #7
0
    // BGM再生(要事前登録)
    public bool PlayBGM(BGMList key, bool loop = true)
    {
        if (false == tableBGM.ContainsKey((int)key))
        {
            // 対応するキーがない場合は再生不可
            Debug.Log("PlayBGM key:" + key + " has not loaded...");
            return(false);
        }

        // いったんBGMを止める
        StopBGM();

        // リソースの取得
        BGMData bgm = tableBGM[(int)key];

        // 再生
        AudioSource source = GetAudioSource(AudioType.BGM);

        source.loop = loop;
        source.clip = bgm.Clip;
        source.Play();

        return(true);
    }
예제 #8
0
 public BGMRepository(BGMData bgmData)
 {
     _bgmData = bgmData;
 }