Exemplo n.º 1
0
 public bool PlayBGM(BGMList soundIndex, float time = 0, float volume = 1.0f)
 {
     if (m_BGMClips.Length - 1 < (int)soundIndex)
     {
         return(false);
     }
     m_BGMSource.clip = m_BGMClips[(int)soundIndex];
     StartCoroutine(FadeIn(m_BGMSource, time, volume));
     //m_BGMSource.Play();
     return(true);
 }
Exemplo n.º 2
0
    /***** 公開関数 ******************************************************************/
    // リソース読み込み(Resources 以下)
    public void LoadBGM(BGMList key, string resName)
    {
        if (tableBGM.ContainsKey((int)key))
        {
            // 登録済みだったら削除(上書きする)
            tableBGM.Remove((int)key);
        }
        tableBGM.Add((int)key, new BGMData(resName));

        return;
    }
Exemplo n.º 3
0
 // BGMのResource取得
 public string GetBGMResource(BGMList key)
 {
     if (bgmResources.Length > (int)key)
     {
         return(bgmResources[(int)key]);
     }
     else
     {
         Debug.Log("BGM list key is out of range... Max:" + bgmResources.Length + ", Selected:" + key);
         return(null);
     }
 }
Exemplo n.º 4
0
        private void playList(BGMList item)
        {
            if (item.shuffle == true)
            {
                item.Randomize();
            }
            currentList = item;

            currentPlaybackIndex = 0;
            Audio.clip           = item.musics[currentPlaybackIndex];
            Audio.Play();
        }
Exemplo n.º 5
0
    private void Awake()
    {
        DontDestroyOnLoad(gameObject);

        if (runMode == RunMode.Release)
        {
            SceneManager.LoadScene(1);
        }

        StartCoroutine(SpawnEnemyTimer());

        audioSource = GetComponent <AudioSource>();
        bgmList     = GetComponent <BGMList>();

        Physics.gravity *= 3f;
    }
Exemplo n.º 6
0
        // BGMリソース取得
        public string GetBGMResource(BGMList key)
        {
            string retStr = universalData.GetBGMResource(key);

            Debug.Log("Get BGMResource Key:" + key + ", Resource:" + retStr);

            if (loadOK)
            {
                return(retStr);
            }
            else
            {
                Debug.Log("DataLibrarian Load Data NG -> cannot get BGMResource...");
                return(null);
            }
        }
Exemplo n.º 7
0
    public static void Format(string asset, string exportedFile)
    {
        BGMList bgmList = ScriptableObjectLoader.Initialize <BGMList>(exportedFile);

        bgmList.Params.Clear();
        foreach (List <string> data in CSVParser.ProcessingData <BGMList>(asset))
        {
            BGMList.Param param = ScriptableObject.CreateInstance <BGMList.Param>();

            param.dictKey   = data[0];
            param.songTitle = data[1];
            param.Tags      = data[2].Split(',').ToList();
            param.BPM       = int.Parse(data[3]);

            if (data.Count < 4)
            {
                continue;
            }
            param.numBeatsPerSegments = (int.Parse(data[4].Split('/')[0]), int.Parse(data[4].Split('/')[1]));
            if (data.Count < 5)
            {
                continue;
            }
            param.loopTimeMarkers = (int.Parse(data[5].Split(',')[0]), int.Parse(data[5].Split(',')[1]));
            if (data.Count < 6)
            {
                continue;
            }
            param.sectionMarkers = data[6].Split(',').ToList().ConvertAll(a => double.Parse(a));
            if (data.Count < 7)
            {
                continue;
            }
            param.subTrackTimeMarkers = data.GetRange(7, data.Count - 6).Select(x => (double.Parse(x.Split(',')[0]), double.Parse(x.Split(',')[1]))).ToList();

            bgmList.Params.Add(param);

            //ここに比較処理を挟みたい
            BGMList.Param checkedParam  = ScriptableObjectLoader.Initialize <BGMList.Param>(param.dictKey); //ファイル名がdictkeyのScriptableObjectの読込/生成
            bool          isDataChanged = param.CompareParam(checkedParam);
            if (!isDataChanged)
            {
                checkedParam = param;
                BGMTimelineCreator.Create(param);
            }
        }
    }
Exemplo n.º 8
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);
    }