Exemplo n.º 1
0
        private SoundGroup GetGroupAndCreateIfMissing(string name)
        {
            SoundGroup group = this.GetGroup(name);

            if (group == null)
            {
                group = this.SoundManager.get_transform().Find <SoundGroup>(name);
                if (group == null)
                {
                    group = this.SoundManager.get_transform().AddChildGameObjectComponent <SoundGroup>(name);
                    if (name != null)
                    {
                        if (!(name == "Bgm"))
                        {
                            if (name == "Ambience")
                            {
                                group.DuckGroups.Add(this.GetGroupAndCreateIfMissing("Voice"));
                            }
                            else if (name == "Voice")
                            {
                                group.AutoDestoryPlayer = true;
                            }
                            else if (name == "Se")
                            {
                                group.AutoDestoryPlayer = true;
                                group.MultiPlay         = true;
                            }
                        }
                        else
                        {
                            group.DuckGroups.Add(this.GetGroupAndCreateIfMissing("Voice"));
                        }
                    }
                }
                group.Init(this);
                this.Groups.Add(name, group);
            }
            return(group);
        }
Exemplo n.º 2
0
        //指定の名前のグループを取得。なければ作成。
        SoundGroup GetGroupAndCreateIfMissing(string name)
        {
            SoundGroup group = GetGroup(name);

            if (group == null)
            {
                //自分の子供以下にあればそれを、なければ自動作成
                group = SoundManager.transform.Find <SoundGroup>(name);
                if (group == null)
                {
                    group = SoundManager.transform.AddChildGameObjectComponent <SoundGroup>(name);
                    switch (name)
                    {
                    case SoundManager.IdBgm:
                        group.DuckGroups.Add(GetGroupAndCreateIfMissing(SoundManager.IdVoice));
                        break;

                    case SoundManager.IdAmbience:
                        group.DuckGroups.Add(GetGroupAndCreateIfMissing(SoundManager.IdVoice));
                        break;

                    case SoundManager.IdVoice:
                        group.AutoDestoryPlayer = true;
                        break;

                    case SoundManager.IdSe:
                        group.AutoDestoryPlayer = true;
                        group.MultiPlay         = true;
                        break;
                    }
                }
                group.Init(this);
                Groups.Add(name, group);
            }
            return(group);
        }
Exemplo n.º 3
0
        public void Play(string groupName, string label, SoundData data, float fadeInTime, float fadeOutTime)
        {
            SoundGroup group = GetGroupAndCreateIfMissing(groupName);

            group.Play(label, data, fadeInTime, fadeOutTime);
        }
Exemplo n.º 4
0
        public void SetMultiPlay(string groupName, bool multiPlay)
        {
            SoundGroup group = GetGroupAndCreateIfMissing(groupName);

            group.MultiPlay = multiPlay;
        }
Exemplo n.º 5
0
        public void SetMasterVolume(string groupName, float volume)
        {
            SoundGroup group = GetGroupAndCreateIfMissing(groupName);

            group.MasterVolume = volume;
        }
Exemplo n.º 6
0
        public void SetAutoDestroyPlayer(string groupName, bool autoDestroy)
        {
            SoundGroup group = GetGroupAndCreateIfMissing(groupName);

            group.AutoDestoryPlayer = autoDestroy;
        }