Beispiel #1
0
        //=============================================================================//
        //============ Lifecycle Methods
        //=============================================================================//
        #region Lifecycle Methods

        /// <summary>
        /// Unity's Awake lifecycle
        /// Will initialize all member's variables and always add the scene containing SceneLoader as the first scene (this one will not be delete in any case)
        /// </summary>
        private void Awake()
        {
            _currentProcess = null;
            _collection     = new SceneCollection();

            InternalSceneData loaderScene = new InternalSceneData(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name, true, false, true, "MainSceneBundle", true);

            SceneLoaderEvents.TriggerOnSceneLoadedInternal(loaderScene);
        }
Beispiel #2
0
        /// <summary>
        /// Unity's Update lifecycle
        /// Will manage the process queue by dequeuing when the scene loader is free and not handling a process.
        /// When a scene loader is handling a process, it will manage event of Start and Finish of the process.
        /// It will internally call update on the current process.
        /// </summary>
        private void Update()
        {
            // If there is a process currently handle call the update on it
            // If the current process has ended, call the event to specify that the process ended
            // and set the process currently handed to null (allowing the scene loaded to handle a new one)
            if (_currentProcess != null)
            {
                _currentProcess.UpdateProcess();

                if (_currentProcess.ProcessFinish)
                {
                    SceneLoaderEvents.TriggerOnLoaderProcessFinish();
                    _currentProcess = null;
                }
            }
        }
Beispiel #3
0
        //=============================================================================//
        //============ Internal Methods
        //=============================================================================//
        #region Internal Methods

        internal void SendRequest(Queue <InternalSceneRequest> requests)
        {
            _currentProcess = new SceneLoaderProcess(_minimumLoadingTime, requests);
            SceneLoaderEvents.TriggerOnLoaderProcessStart();
        }