Пример #1
0
 /// <summary>
 /// 管理しているオブジェクトを破棄します。
 /// </summary>
 public static void Release()
 {
     if (s_Instance == null)
     {
         return;
     }
     s_SharedPlayingList = null;
     GameObject.Destroy(s_Instance, 0.1f);
     s_Instance = null;
 }
Пример #2
0
        public static SoundObject Create(PlayingList playingList, Transform parent)
        {
            SoundObject ret = new SoundObject();
            var         obj = new GameObject(nameof(SoundObject));

            obj.hideFlags = parent.hideFlags;
            obj.transform.SetParent(parent);
            var source = obj.AddComponent <AudioSource>();

            source.playOnAwake   = false;
            ret.m_PlayingList    = playingList;
            ret.m_Object         = obj;
            ret.m_Source         = source;
            ret.m_TransformCache = source.transform;
            obj.SetActive(false);
            return(ret);
        }