//used to get a reference to the collsion manager public void CollisionManagerGet(CollisionManager col) { this.col = col; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); uiSpriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here //loads the texture for the sprite sheet for the player, just using the one from the practice exercise, cause it was easier System.IO.Stream imageStream = TitleContainer.OpenStream("Content/player_spritesheet.png"); Texture2D spriteSheet = Texture2D.FromStream(GraphicsDevice, imageStream); player = new Player(100, 228, 34, 55, 64, 70, spriteSheet, Content.Load <Texture2D>("Normals/BlankNormal.png")); player.getUISpriteBatch(uiSpriteBatch); imageStream.Close(); collisionManager = new CollisionManager(player); player.CollisionManagerGet(collisionManager); //Loads the spriteFont font = Content.Load <SpriteFont>("TimesNewRoman12"); roomManager = new RoomManager(player, collisionManager, font, Content, GraphicsDevice); roomManager.LoadContent(GraphicsDevice); player.RoomManagerGet(roomManager); if (enableShaders) { lightingEffect = LoadEffect("Content/Test.mgfx"); postEffect = LoadEffect("Content/PostProcess.mgfx"); bumpEffect = LoadEffect("Content/BumpMapper.mgfx"); } health = new Rectangle(player.X - (player.Rect.Width + 20 - player.Rect.Width) / 2, player.Y - 30, player.Rect.Width + 20, 5); healthBox = health; System.IO.StreamReader input = null; if (System.IO.File.Exists("Scores.txt")) { try { input = new System.IO.StreamReader("Scores.txt"); string line = null; while ((line = input.ReadLine()) != null && alreadyRead == false) { scores.Add(Int32.Parse(line)); } } catch (Exception e) { Console.WriteLine(e.Message); } finally { input.Close(); } } //string line; //// Read the file and display it line by line. //System.IO.StreamReader file = new System.IO.StreamReader("Scores.txt"); //while ((line = file.ReadLine()) != null && alreadyRead ==false) //{ // scores.Add(Int32.Parse(line)); //} alreadyRead = true; //file.Close(); }