Exemplo n.º 1
0
        /// <summary>
        /// Switches the domain with specified domain switch effect.
        /// </summary>
        /// <param name="domain">The new domain.</param>
        /// <param name="switchEffect">The switch effect.</param>
        /// <param name="timeToSwitch">The time to switch.</param>
        public void SetScene(Scene scene, ISceneSwitchEffect switchEffect, float timeToSwitch)
        {
            if (null == scene) throw new ArgumentNullException("scene");

            waitFrame += () =>
            {
                if (null != switchEffect)
                {
                    StartEffect(switchEffect, timeToSwitch);
                }

                if (_sceneStack.Count > 0)
                {
                    var pop = _sceneStack.Pop();
                    pop.Deactivate();
                    pop.DeactivateResource();
                }

                //change domain
                _sceneStack.Push(scene);

                //invoke activate for new domain...
                if (null != scene)
                {
                    scene.BindService = this.Services;
                    scene.ActivateResource();
                    scene.Activate();
                }
            };
        }