Exemple #1
0
        /** [シングルトン]削除。
         */
        private void Delete()
        {
            this.se_audiosource_monobehaviour.Delete();
            this.se_audiosource_monobehaviour = null;

            this.soundpool.Delete();
            this.soundpool = null;

            UnityEngine.GameObject.Destroy(this.root_gameobject);
        }
Exemple #2
0
        /** [シングルトン]constructor
         */
        private Audio()
        {
            //サウンドプール。
            this.soundpool = new SoundPool();

            //ボリューム。マスター。
            this.volume_master = new Volume(Config.DEFAULT_VOLUME_MASTER);

            //ボリューム。SE。
            this.volume_se = new Volume(Config.DEFAULT_VOLUME_SE);

            //ボリューム。BGM。
            this.volume_bgm = new Volume(Config.DEFAULT_VOLUME_BGM);

            //ルート。
            this.root_gameobject      = new UnityEngine.GameObject();
            this.root_gameobject.name = "Audio";
            UnityEngine.Transform t_root_transform = this.root_gameobject.GetComponent <UnityEngine.Transform>();
            UnityEngine.GameObject.DontDestroyOnLoad(this.root_gameobject);

            //オーディオソース。SE。
            {
                this.se_audiosource_gameobject      = new UnityEngine.GameObject();
                this.se_audiosource_gameobject.name = "Se";
                this.se_audiosource_gameobject.transform.SetParent(t_root_transform);
                this.se_audiosource_gameobject.AddComponent <UnityEngine.AudioSource>();
                this.se_audiosource_monobehaviour = this.se_audiosource_gameobject.AddComponent <Se_AudioSource_MonoBehaviour>();
                this.se_audiosource_monobehaviour.Initialize(this.volume_master, this.volume_se);
            }

            //オーディオソース。BGM。
            {
                this.bgm_audiosource_gameobject      = new UnityEngine.GameObject();
                this.bgm_audiosource_gameobject.name = "Bgm";
                this.bgm_audiosource_gameobject.transform.SetParent(t_root_transform);
                this.bgm_audiosource_gameobject.AddComponent <UnityEngine.AudioSource>();
                this.bgm_audiosource_gameobject.AddComponent <UnityEngine.AudioSource>();
                this.bgm_audiosource_monobehaviour = this.bgm_audiosource_gameobject.AddComponent <Bgm_AudioSource_MonoBehaviour>();
                this.bgm_audiosource_monobehaviour.Initialize(this.volume_master, this.volume_bgm);
            }

            //フォーカス。
            this.is_focus = false;
        }