public Mario(List <Texture2D> texturesFacingRight, List <Texture2D> texturesFacingLeft, Floor flr, UserMarioMovingStrategy strtgy, List <Heart> hrtsLst) : base(texturesFacingRight, texturesFacingLeft, new Vector2(MARIOSTARTLOC.X, MARIOSTARTLOC.Y - texturesFacingLeft.ElementAt(0).Height *0.6f), 0.6f, true, MARIOACCELERATIONX, MARIOJUMPOWER, MARIOMAXNORMALSPEEDX, flr, strtgy) { this.hrtsLst = hrtsLst.ToList(); turnsCountFromHit = -1; hasLost = false; points = 0; distanceAcc = 0; lastXtoRaisePoints = 0; wpnsInventory = new Weapon[INVENTORY_SIZE]; currWpnInd = 0; focousedChest = null; shotThisFrame = null; }
/// <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); fntForPauseOrDeath = Content.Load <SpriteFont>("FntForPauseOrDeath"); blkScrn = new BlackScreen(Content.Load <Texture2D>(BlackScreen.textureName)); blkScrn.Hide(); allMenuObjects.Add(blkScrn); bckgrnd = new Background(Content.Load <Texture2D>("background"), Content.Load <Texture2D>("background"), GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, allNotMenuObjects); List <Texture2D> mrioFacingRightTextures = new List <Texture2D>(); List <Texture2D> mrioFacingLeftTextures = new List <Texture2D>(); foreach (string assetName in Mario.texturesNameFacingRight) { mrioFacingRightTextures.Add(Content.Load <Texture2D>(assetName)); } foreach (string assetName in Mario.texturesNameFacingLeft) { mrioFacingLeftTextures.Add(Content.Load <Texture2D>(assetName)); } Floor flr = new Floor(bckgrnd.GameWidth, bckgrnd.GameHeight); Texture2D hrtTexture = Content.Load <Texture2D>(Heart.textureName); List <Heart> hrts = new List <Heart>(); hrts.Add(new Heart(hrtTexture, 10)); hrts.Add(new Heart(hrtTexture, hrts[0].Right + 5)); hrts.Add(new Heart(hrtTexture, hrts[1].Right + 5)); mrioStrategy = new UserMarioMovingStrategy(); mrio = new Mario(mrioFacingRightTextures, mrioFacingLeftTextures, flr, mrioStrategy, hrts); allNotMenuObjects.Add(flr); Pipe pip = new Pipe(Content.Load <Texture2D>(Pipe.textureName), 800, 0.7f); allNotMenuObjects.Add(pip); foreach (Heart hrt in hrts) { allNotMenuObjects.Add(hrt); } crtr = new GameObjsCreator(pip, flr, this, mrio); HugeCannonBomb cnnBmbHuge = crtr.CreateHugeCannonBomb(); if (cnnBmbHuge != null) { allNotMenuObjects.Add(cnnBmbHuge); } List <Texture2D> gmbaFacingRightTextures = new List <Texture2D>(); List <Texture2D> gmbaFacingLeftTextures = new List <Texture2D>(); foreach (string assetName in Goomba.texturesNameFacingRight) { gmbaFacingRightTextures.Add(Content.Load <Texture2D>(assetName)); } foreach (string assetName in Goomba.texturesNameFacingLeft) { gmbaFacingLeftTextures.Add(Content.Load <Texture2D>(assetName)); } Texture2D gmbaDeadTxtr = Content.Load <Texture2D>(Goomba.deadTextureNm); Texture2D gmbaDeadTxtrFlipped = Content.Load <Texture2D>(Goomba.deadTextureFlippedNm); Goomba gmba = new Goomba(gmbaFacingRightTextures, gmbaFacingLeftTextures, flr, 500, new RandomLeftRightStay(), gmbaDeadTxtr, gmbaDeadTxtrFlipped, mrio.Points); allNotMenuObjects.Add(mrio); allNotMenuObjects.Add(gmba); List <GameObject> invntryStrip = crtr.CreateInventoryStrip(bckgrnd.GameWidth); for (int i = 1; i < invntryStrip.Count; i++) { mrioInventoryCells.Add(invntryStrip[i] as ItemCell); } allMenuObjects.AddRange(invntryStrip); chestStrip = crtr.CreateChestInvStrip(bckgrnd.GameWidth, bckgrnd.GameHeight); for (int i = 1; i < chestStrip.Count; i++) { chestWpnsCells[i - 1] = chestStrip[i] as ItemCell; } }