Exemple #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);
        }
Exemple #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);
        }