public override void Draw() { //--------------------Prepare Draw-------------------- mScene.RenderList = mScene.RenderList.OrderBy(iobj => iobj.NormalZ).ToList(); //Wird DrawZ vom Character genommen wenn er als IObj betrachtet wird? //Temporär immer neu aufbauen, sollte später anders umgesetzt werden, wie RenderList List <Light> LightList = new List <Light>(mScene.Lights) { mLogic.ItemHandler.LanternLight }; //--------------------Renderer (Game & Lighting)-------------------- EngineSettings.Graphics.GraphicsDevice.SetRenderTarget(null); mRenderer.SetGBuffer(); mRenderer.ClearGBuffer(); mRenderer.Begin(mCamera.Transform); //Render Background mScene.BackgroundTexture.Draw(mRenderer); //Render Game foreach (InteractiveObject iObj in mScene.RenderList) { if (iObj.IsVisible) { iObj.Draw(mRenderer); } } mRenderer.End(); //--------------------DrawToScreen-------------------- mRenderer.DisposeGBuffer(); mRenderer.ProcessLight(LightList, mCamera.Transform); mRenderer.ProcessFinalScene(); mRenderer.DrawFinalTargettOnScreen(mSpriteBatch); if (GameReferenzes.Level.Fog) { mRenderer.ApplyFog(mCamera.Transform); } //--------------------SpriteBatch WorldSpace(HUD & Infos)-------------------- mSpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, mCamera.Transform); //Render ActionInfo mLogic.ActivityHandler.DrawActionInfo(mSpriteBatch, mHansel, mGretel); //Render ButtonHud mLogic.ActivityHandler.DrawActivityInstruction(mSpriteBatch, mHansel, mGretel); mSpriteBatch.End(); //--------------------SpriteBatch ScreenSpace(PauseMenu & SceneSwitch)-------------------- mSpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); //Render SceneSwitch darken mSpriteBatch.Draw(TextureManager.Instance.GetElementByString("pixel"), new Rectangle(0, 0, 1280, 720), Color.Black * mLogic.SceneSwitchHandler.Fading); //Render PauseMenu if (mState == GameState.CollectableInfo) { mSpriteBatch.Draw(mSavegame.Collectables[mSavegame.Collectables.Count - 1].ShowTexture, new Vector2(50, 50), Color.White); } mPauseMenu.Draw(mSpriteBatch); if (mState == GameState.End) { mSpriteBatch.Draw(TextureManager.Instance.GetElementByString("pixel"), new Rectangle(0, 0, 1280, 720), Color.Black * mEndGameFading.Progress); mSpriteBatch.Draw(mEndGameTexture, Vector2.Zero, Color.White); } mSpriteBatch.End(); #region Debug #if DEBUG if (EngineSettings.IsDebug) { mSpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, mCamera.Transform); mScene.DrawDebug(mSpriteBatch); for (int i = mScene.RenderList.Count - 1; i >= 0; --i) { mScene.RenderList[i].DrawDebug(mSpriteBatch); } //AIManager.Instance.DrawDebugAiGrid(mSpriteBatch); mSpriteBatch.End(); SpriteFont font = FontManager.Instance.GetElementByString("font"); StringBuilder sb = new StringBuilder(); if (GameReferenzes.TargetPlayer != null && GameReferenzes.UntargetPlayer != null) { sb.AppendLine("Abstand: " + Vector2.Distance(GameReferenzes.TargetPlayer.Position, GameReferenzes.UntargetPlayer.Position).ToString()); } sb.AppendLine("--------------------Player--------------------"); sb.AppendLine("Hansel: __Pos_ " + mHansel.SkeletonPosition.ToString() + " __CBox_ " + mHansel.CollisionBox.ToString() + " __BTemp_ " + mHansel.BodyTemperature.ToString()); sb.AppendLine("Gretel: __Pos_ " + mGretel.SkeletonPosition.ToString() + " __CBox_ " + mGretel.CollisionBox.ToString() + " __BTemp_ " + mGretel.BodyTemperature.ToString()); sb.AppendLine("--------------------Camera--------------------"); sb.AppendLine("Camera: __Pos_ " + (mCamera.Position - new Vector2(EngineSettings.VirtualResWidth, EngineSettings.VirtualResHeight) / 2).ToString() + " __GameScreen_ " + mCamera.GameScreen.ToString()); sb.AppendLine("--------------------ActivityStates--------------------"); sb.AppendLine("Hansel: __State_ " + mHansel.mCurrentState + " __ActivityState_ " + mHansel.mCurrentActivity.GetType().ToString()); sb.AppendLine("Gretel: __State_ " + mGretel.mCurrentState + " __ActivityState " + mGretel.mCurrentActivity.GetType().ToString()); sb.AppendLine("--------------------ThumbstickRotation--------------------"); sb.AppendLine("Rotation: " + mHansel.Input.LeftStickRotation.ToString()); sb.AppendLine("Mit Uhrzeiger"); for (int i = 0; i < (int)(mHansel.Input.LeftStickRotation * 1000); ++i) { sb.Append("|"); } sb.AppendLine(""); sb.AppendLine("Gegen Uhrzeiger"); for (int i = 0; i > (int)(mHansel.Input.LeftStickRotation * 1000); --i) { sb.Append("|"); } sb.AppendLine(""); sb.AppendLine("-------------------- --------------------"); mSpriteBatch.Begin(); mSpriteBatch.DrawString(font, sb, new Vector2(10, 10), Color.White * 0.5f, 0f, Vector2.Zero, 1.1f, SpriteEffects.None, 0f); mSpriteBatch.End(); } #endif #endregion }