public Texture2D getBackgroundTexture() { if (inDungeon && hasDungeon) { if (dtextureGenerated) { return(backgroundTexture); } else { if (dbackgroundBitmap == null || textureOld) { dbackgroundBitmap = TextureManager.BitmapFrom2DTileMap(backgroundTiles); backgroundTexture = TextureManager.TextureFromBitmap(dbackgroundBitmap); dtextureGenerated = true; textureGenerated = false; return(backgroundTexture); } else { backgroundTexture = TextureManager.TextureFromBitmap(dbackgroundBitmap); dtextureGenerated = true; textureGenerated = false; return(backgroundTexture); } } } else { if (textureGenerated) { return(backgroundTexture); } else { if (backgroundBitmap == null || textureOld) { backgroundBitmap = TextureManager.BitmapFrom2DTileMap(backgroundTiles); backgroundTexture = TextureManager.TextureFromBitmap(backgroundBitmap); textureGenerated = true; return(backgroundTexture); } else { backgroundTexture = TextureManager.TextureFromBitmap(backgroundBitmap); textureGenerated = true; return(backgroundTexture); } } } }