Exemplo n.º 1
0
        public override void DrawScene(GameTime gameTime)
        {
            #region Debug
            DebugConsole.Update();
            #endregion

            #region Scripts
            if (!_Interface.IsInterfaceBlocking())
            {
                _Service.CheckParallelProcessAndAutomaticAndContactScripts(_ProjectData.Resolution.MatrixPrecision);
                ScriptManager.RunParallelScripts();
                ScriptManager.RunScript(ScriptManager.CurrentScript, false);
            }

            if (ScriptManager.GoToScreen != null && !_LaunchedEndingScripts)
            {
                LaunchEndingScript();
            }

            if (ScriptManager.GameOver)
            {
                VO_RunningScript runningScript = new VO_RunningScript();
                runningScript.Id            = _ProjectData.GameOver.Id;
                runningScript.Lines         = _ProjectData.GameOver.Lines;
                ScriptManager.CurrentScript = runningScript;
                ScriptManager.GameOver      = false;
            }
            #endregion

            _SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Camera2D.GetTransformation(this.GraphicsDevice));
            #region Décors et objets derrière perso
            int i = 1;
            _Stage.ListCharacters.OrderBy(p => p.Location.Y);
            int playerLayerIndex = _Service.GetLayerIndexFromCharacterLocation(PlayableCharactersManager.CurrentPlayerCharacter.CharacterSprite.Location);
            foreach (VO_Layer layer in _Stage.ListLayers)
            {
                RefreshLayer(layer, layer.MainLayer, !_Interface.IsInterfaceBlocking());
                RefreshCharacters(i, layer.MainLayer, playerLayerIndex, !_Interface.IsInterfaceBlocking());
                i++;
            }
            #endregion
            _SpriteBatch.End();

            _SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            #region Interface
            if (ScriptManager.ScriptUserControls)
            {
                _Interface.Draw(gameTime, ScriptManager.BlockType);
            }
            #endregion
            #region Messages
            if (!_Interface.IsInterfaceBlocking())
            {
                RefreshMessage(ScriptManager.CurrentScript);
                RefreshChoiceMessage(ScriptManager.CurrentScript, gameTime);
                if (ScriptManager.ParallelScripts != null)
                {
                    foreach (VO_RunningScript script in ScriptManager.ParallelScripts)
                    {
                        RefreshMessage(script);
                    }
                }
            }
            #endregion
            #region Debug
            DebugConsole.Draw();
            #endregion
            _SpriteBatch.End();
        }