예제 #1
0
        private void OnAssetLoaded(object sender, EventArgs args)
        {
            waitCounter--;
            if (waitCounter != 0)
            {
                return;
            }

            PreloadCompleted?.Invoke(this, EventArgs.Empty);
        }
예제 #2
0
        public void StartPreloading()
        {
            bool loadStarted = false;

            foreach (AssetLoader loader in loaderList)
            {
                if (loader.IsReady)
                {
                    continue;
                }

                waitCounter++;
                loader.AssetLoadedUntyped += OnAssetLoaded;
                loader.LoadAsset();
                loadStarted = true;
            }

            if (!loadStarted)
            {
                PreloadCompleted?.Invoke(this, EventArgs.Empty);
            }
        }