public void drawMain(float a_elapsedTime, GraphicsDevice a_graphics, Model.Levels a_level, Camera a_camera, Vector2 a_playerPosition, Model.StateHandler.LevelState a_LevelState, Model.StateHandler.CharStates a_charState, Model.StateHandler.CharFaceState a_charFaceState, List<Vector2> a_drawEnemy, List<Vector2> a_drawBoltEnemy) { //SÄTTER ALLT SOM RITAS UT TILL RENDERTARGET MAINSCENE SÅ ATT DET PÅVERKAS RÄTT UTAV FICKLAMPAN a_graphics.SetRenderTarget(mainScene); a_graphics.Clear(Color.Black); torchPositions = new List<Vector2>(); var mouse = Mouse.GetState(); mousePosition = new Vector2(mouse.X, mouse.Y); float scale = a_camera.GetScale(); Vector2 viewportSize = new Vector2(a_graphics.Viewport.Width, a_graphics.Viewport.Height); Vector2 playerViewPos = a_camera.GetViewPosition(a_playerPosition.X, a_playerPosition.Y, viewportSize); Vector2 displacement = new Vector2(a_graphics.Viewport.Width, a_graphics.Viewport.Height); m_time += a_elapsedTime / 10.0f; //TILLDELAR TILES OCH PARTIKEL SYSTEM SOM SKALLF FINNAS PÅ BANA 1 if(m_level ==1) { SetBackground(m_level); DrawBackGround(GetBackground(), a_graphics); for (int x = 0; x < Model.Levels.g_levelWidth; x++) { for (int y = 0; y < Model.Levels.g_levelHeight; y++) { Vector2 viewPos = a_camera.GetViewPosition(x, y, viewportSize); DrawTile(viewPos.X, viewPos.Y, scale, a_level.m_tiles[x, y]); } } a_rainSystem.DrawRainDrops(m_spriteBatch, m_rainTexture, a_elapsedTime); } //TILLDELAR RÄTT TILES FÖR BANA 2 if (m_level == 2) { SetBackground(m_level); DrawBackGround(GetBackground(), a_graphics); for (int x = 0; x < Model.Levels.g_levelWidth; x++) { for (int y = 0; y < Model.Levels.g_levelHeight; y++) { Vector2 viewPos = a_camera.GetViewPosition(x, y, viewportSize); //DrawTile(viewPos.X, viewPos.Y, scale, a_level.m_tiles[x, y]); DrawTileLevel2(viewPos.X, viewPos.Y, scale, a_level.m_tiles2[x, y]); } } } //BANA 3, TILLDELAR RÄTT TILE VÄRDEN OCH VILKEN PARTICEL EFFEKT SOM SKALL RITAS UT if (m_level == 3) { SetBackground(m_level); DrawBackGround(GetBackground(), a_graphics); for (int x = 0; x < Model.Levels.g_levelWidth; x++) { for (int y = 0; y < Model.Levels.g_levelHeight; y++) { Vector2 viewPos = a_camera.GetViewPosition(x, y, viewportSize); DrawTileLevel3(viewPos.X, viewPos.Y, scale, a_level.m_tiles3[x, y]); } } a_ashSystem.DrawAshes(m_spriteBatch, m_ashes, a_elapsedTime); } //RITAR UT RESTERANDE OBEROENDE VILKEN BANA. DrawEnemy(a_drawEnemy, viewportSize, a_camera, scale); DrawBoltEnemy(a_drawBoltEnemy, viewportSize, a_camera, scale); DrawPlayerAt(playerViewPos, scale, a_elapsedTime, a_charState, a_charFaceState); a_graphics.SetRenderTarget(null); }
public void DrawLevel(GraphicsDevice a_graphicsDevice, Model.Levels a_level, Camera a_camera, Vector2 a_playerPosition, float a_elapsedTime, Model.StateHandler.LevelState a_LevelState, GraphicsDeviceManager a_manager, Model.StateHandler.CharStates a_charState, Model.StateHandler.CharFaceState a_charFaceState, List<Vector2> a_drawEnemy, List<Vector2> a_drawBoltEnemy, int m_playerHp, bool a_isInAir) { m_isInAir = a_isInAir; float scale = a_camera.GetScale(); Vector2 viewPortSize = new Vector2(a_graphicsDevice.Viewport.Width, a_graphicsDevice.Viewport.Height); Vector2 playerViewPos = a_camera.GetViewPosition(a_playerPosition.X, a_playerPosition.Y, viewPortSize); Vector2 displacement = new Vector2(a_graphicsDevice.Viewport.Width, a_graphicsDevice.Viewport.Height); m_time += a_elapsedTime / 10.0f; torchPositions = new List<Vector2>(); var mouse = Mouse.GetState(); mousePosition = new Vector2(mouse.X, mouse.Y); // m_spriteBatch.Begin(); a_graphicsDevice.Clear(Color.Transparent); //m_spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend,null, null, null, lightningEffect); Draw(scale, a_elapsedTime, a_graphicsDevice, a_level, a_camera, a_playerPosition, a_LevelState, a_charState,a_charFaceState, a_drawEnemy, a_drawBoltEnemy); m_spriteBatch.End(); m_spriteBatch.Begin(); m_spriteBatch.DrawString(m_hpFont, "Hope " + m_playerHp.ToString(), m_hpPos, Color.Red); //DrawUI(m_playerHp); m_spriteBatch.End(); a_graphicsDevice.SetRenderTarget(null); }