Ejemplo n.º 1
0
 public static void getEventSystem(FmodEventSystemHandle handle)
 {
     if (handle.getEventSystem() == null)
     {
         if (m_holder == null)
         {
             m_holder = GameObject.FindObjectOfType(typeof(FmodEventSystemHolder)) as FmodEventSystemHolder;
             if (m_holder == null)
             {
                 UnityEngine.GameObject holderObject = new UnityEngine.GameObject("FmodEventSystemHolder");
                 holderObject.AddComponent(typeof(FmodEventSystemHolder));
                 m_holder = holderObject.GetComponent <FmodEventSystemHolder>();
             }
         }
         if (m_holder == null)
         {
             Debug.LogError("Could not find FmodEventSystemHolder; FMOD integration will not work");
         }
         else
         {
             if (m_FmodEventSystem == null)
             {
                 m_FmodEventSystem = new FmodEventSystem();
                 m_FmodEventSystem._createEventSystem();
                 m_holder.SetFmodEventSystemHandle(new FmodEventSystemHandle());
             }
             handle.setEventSystem(m_FmodEventSystem);
             GetReverbManager();
         }
     }
 }
Ejemplo n.º 2
0
 public static void getEventSystem(FmodEventSystemHandle handle)
 {
     if (handle.getEventSystem() == null) {
         if (m_holder == null) {
             m_holder = GameObject.FindObjectOfType(typeof(FmodEventSystemHolder)) as FmodEventSystemHolder;
             if (m_holder == null) {
                 UnityEngine.GameObject holderObject = new UnityEngine.GameObject("FmodEventSystemHolder");
                 holderObject.AddComponent(typeof(FmodEventSystemHolder));
                 m_holder = holderObject.GetComponent<FmodEventSystemHolder>();
             }
         }
         if (m_holder == null) {
             Debug.LogError("Could not find FmodEventSystemHolder; FMOD integration will not work");
         } else {
             if (m_FmodEventSystem == null) {
                 m_FmodEventSystem = new FmodEventSystem();
                 m_FmodEventSystem._createEventSystem();
                     m_holder.SetFmodEventSystemHandle(new FmodEventSystemHandle());
             }
             handle.setEventSystem(m_FmodEventSystem);
             GetReverbManager();
         }
     }
 }
Ejemplo n.º 3
0
    public void OnEnable()
    {
        FmodEventSystemHolder holder = FmodEventSystem.getEventSystemHolder();

        if (holder != null && holder != this)
        {
            Component[] comps = gameObject.GetComponents <Component>();

            if (comps.Length == 2)               // if only transform and holder comps, we can delete the gameObject
            {
                Destroy(gameObject);
            }
            else                 // if there are any other components, we can't delete the gameObject, but we can delete the comp
            {
                Destroy(this);
            }
        }
        else
        {
#if UNITY_EDITOR
            EditorApplication.playmodeStateChanged += clean;
#endif
        }
    }