private void Awake() { _processLoaderFinish = false; _builtRequestsForLoader = null; _isFading = false; _currentRequest = null; _marshaller = new SceneMarshaller(); _requests = new Queue <SceneLoaderRequest>(); }
private void Update() { if (_processLoaderFinish && _isFading == false) { _processLoaderFinish = false; if (_fader != null) { _isFading = true; _fader.OnFadeInCompleted += FadeInCompletedProcessFinish; _fader.FadeIn(); } } if (_currentRequest == null && _requests.Count > 0 && _sceneLoader.IsBusy == false) { _currentRequest = _requests.Dequeue(); SceneLoaderRequestResult inspectionResult = _currentRequest.Inspection(_sceneLoader.Collection); _currentRequest.Callback?.Invoke(inspectionResult.IsSuccess); if (inspectionResult.IsSuccess) { Queue <InternalSceneRequest> requests = _currentRequest.BuildRequests(_sceneLoader.Collection); if (requests != null && requests.Count > 0) { if (_fader != null) { _builtRequestsForLoader = requests; _isFading = true; _fader.OnFadeInCompleted += FadeInCompletedProcessStart; _fader.FadeIn(); } else { _sceneLoader.SendRequest(requests); } } } _currentRequest = null; } }
//=============================================================================// //============ Public Methods //=============================================================================// #region Public Methods public void PostRequest(SceneLoaderRequest loadRequest) { AttemptClearOlderRequests(); _requests.Enqueue(loadRequest); }