Пример #1
0
        /* called by onEngineSceneLoaded, fetch something in dependencies that are now ready to be fetched */
        virtual protected void setup()
        {
#if poc
            //link to engine to be updated
            EngineManager.subscribe(this); // to have updates functions working
#endif
        }
Пример #2
0
 static public EngineManager get()
 {
     if (_manager == null)
     {
         _manager = GameObject.FindObjectOfType <EngineManager>();
     }
     return(_manager);
 }
Пример #3
0
        virtual protected void destroy()
        {
#if poc
            //Debug.Log(name + " destroy() ", gameObject);
            //if (eos.IndexOf(this) > -1) eos.Remove(this);
            EngineManager.unsubscribe(this);
#endif
        }
Пример #4
0
        static public void create()
        {
            EngineManager em = GameObject.FindObjectOfType <EngineManager>();

            if (em == null)
            {
                em = new GameObject("[engine]").AddComponent <EngineManager>();
                Debug.LogWarning("engine manager wasn't loaded or is non existent. creating one");
            }
        }
Пример #5
0
        IEnumerator processStartup(Action onComplete = null)
        {
            Coroutine co = null;

            //leave a few frame for loading screen to be created and displayed
            yield return(null);

            yield return(null);

            yield return(null);

            ///// then we load engine, to get the feeder script
            co = loadScenes(new string[] { prefix + "engine" });
            while (queries.IndexOf(co) > -1)
            {
                yield return(null);
            }

            //NEEDED
#if poc
            EngineManager.create();
#endif

            Scene sc = SceneManager.GetActiveScene();
            cleanScene(sc);

            ///// feeder, additionnal scenes (from feeder script)
            EngineLoaderFeeder[] feeders = GameObject.FindObjectsOfType <EngineLoaderFeeder>();

            List <string> all = new List <string>();
            for (int i = 0; i < feeders.Length; i++)
            {
                if (feeders[i] != null)
                {
                    all.AddRange(feeders[i].feed());
                }
            }

            //string debugContent = "~EngineLoader~ now loading <b>" + all.Count + " scenes</b> ... ";
            //for (int i = 0; i < all.Count; i++) debugContent += "\n  " + all[i];

            co = loadScenes(all.ToArray());
            while (queries.IndexOf(co) > -1)
            {
                yield return(null);
            }

            if (onComplete != null)
            {
                onComplete();
            }
        }
Пример #6
0
        private IEnumerator Start()
        {
            //si le manager recoit l'event de fin de loading après que Start soit exec
            //yield return null;

//usually objects startup their dependencies in the onEngineSceneLoaded
//so if the object as other monobehavior generated at the same time (same Resource object) engine needs a frame to have all dependencies finish their build() process

//Debug.Log(GetType() + " <b>" + name + "</b> START", gameObject);

#if poc
            if (EngineLoader.compatibility)
            {
                //attendre que le l'engine ai démarré
                //qui doit etre contenu dans resource-engine.scene
                while (EngineManager.get() == null)
                {
                    yield return(null);
                }
                while (EngineManager.isLoading())
                {
                    yield return(null);
                }
            }
#endif

            //si le manager recoit l'event de fin de loading après que Start soit exec
            //il y aura un UPDATE de l'engine avant de repasser par ici et de setup l'objet
            //while (EngineManager.isLoading()) yield return null;

            setupEarly();

            yield return(null);

            setup();

            yield return(null);

            setupLate();

            _ready = true; // all setup done, can now update
        }