Exemplo n.º 1
0
        private void CreateArena(ArenaConfig arenaConfig, bool animate, Action callback = null)
        {
            GameObject arenaObject = arenaConfig.CreateArena(parent: this.gameObject);

            loadedArena_ = new Arena(arenaObject);

            if (animate)
            {
                loadedArenaBackdrop_ = new RandomizedArenaBackdrop(backdropContainer_, arenaObject);
                loadedArena_.AnimateIn(callback);
            }
            else
            {
                if (callback != null)
                {
                    callback.Invoke();
                }
            }
        }
Exemplo n.º 2
0
        public void AnimateLoadArena(ArenaConfig arenaConfig, Action callback)
        {
            if (animating_)
            {
                TriggerQueuedCallback();
                queuedAnimatedArenaLoad_ = arenaConfig;
                queuedCallback_          = callback;
                return;
            }

            Action wrappedCallback = () => {
                animating_ = false;
                if (callback != null)
                {
                    callback.Invoke();
                }

                if (queuedAnimatedArenaLoad_ != null)
                {
                    ArenaConfig queuedArena = queuedAnimatedArenaLoad_;
                    queuedAnimatedArenaLoad_ = null;
                    AnimateLoadArena(queuedArena, TriggerQueuedCallback);
                }
            };

            animating_ = true;
            if (loadedArena_ != null)
            {
                loadedArenaBackdrop_.AnimateOut();
                loadedArena_.AnimateOut(() => {
                    CleanupLoadedArena();
                    CreateArena(arenaConfig, animate: true, callback: wrappedCallback);
                });
            }
            else
            {
                CleanupLoadedArena();
                CreateArena(arenaConfig, animate: true, callback: wrappedCallback);
            }
        }
Exemplo n.º 3
0
        public void AnimateLoadRandomArena(Action callback)
        {
            ArenaConfig config = arenas_.Random();

            AnimateLoadArena(config, callback);
        }