Exemplo n.º 1
0
        protected override void Draw(GameTime gameTime)
        {
            _elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (DrawingManager.IgnoreClearBeforeRendering == false)
            {
                this.GraphicsDevice.Clear(this.DefaultClearColor);
            }

            if (SceneManager.ActiveScene != null)
            {
                if (SceneManager.Scenes.Count > 1)
                {
                    for (int i = 0; i < SceneManager.Scenes.Count; i++)
                    {
                        SquidScene item = SceneManager.Scenes[i];

                        if (item != SceneManager.ActiveScene && item.WillRenderNotActive)
                        {
                            SquidCore.DrawSquidEngineScene(graphics.GraphicsDevice, _elapsed, item);
                        }
                    }
                }
                if (SceneManager.ActiveScene._hasBeenUpdatedOnce == true)
                {
                    SquidCore.DrawSquidEngineScene(graphics.GraphicsDevice, _elapsed, SceneManager.ActiveScene);
                }
                SquidCore.RenderSquidEngine();
            }

            //for (int y = 0; y < SceneManager.ActiveScene._spatialGrid.Rows; y++)
            //{
            //    for (int x = 0; x < SceneManager.ActiveScene._spatialGrid.Cols; x++)
            //    {
            //        Drawing.DebugShapes.DrawLine(
            //            new Vector2(x * SceneManager.ActiveScene._spatialGrid.CellSize,
            //                        0),
            //            new Vector2(x * SceneManager.ActiveScene._spatialGrid.CellSize,
            //                        SceneManager.ActiveScene._spatialGrid.SceneHeight),
            //            Color.White);

            //    }
            //    Drawing.DebugShapes.DrawLine(
            //            new Vector2(0,
            //                y * SceneManager.ActiveScene._spatialGrid.CellSize),
            //            new Vector2(SceneManager.ActiveScene._spatialGrid.SceneWidth,
            //                y * SceneManager.ActiveScene._spatialGrid.CellSize),
            //            Color.White);
            //}



            base.Draw(gameTime);
        }
Exemplo n.º 2
0
        protected override void Update(GameTime gameTime)
        {
            SquidCore.GameTime = gameTime;
            _elapsed           = (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (SceneManager.ActiveScene != null && !SquidCore.activeSceneChanged)
            {
                SquidCore.UpdateSquidEngine(_elapsed);
            }
            else
            {
                SquidCore.activeSceneChanged = false;
            }

            base.Update(gameTime);
        }