public FireMarioState(Mario mario) { this.mario = mario; this.mario.PoweredUp = true; this.mario.SpriteFactory = FireMarioFactory.GetInstance(); this.mario.UpdateActionSprite(); }
public void Setup() { FireMarioFactory.GetInstance().ChangeTexture(_costumes[Index].MarioTexture); Mario.GetInstance().UpdateActionSprite(); ItemFactory.GetInstance().ChangeTexture(_costumes[Index].ItemTexture); Mario.GetInstance().GravityIntensity = _costumes[Index].MarioGravityIntensity; Mario.GetInstance().UpdateFireballsAndSword(_costumes[Index].ProjectileNum, _costumes[Index].ProjectileGravity, _costumes[Index].ProjectileYBounceSpeed, _costumes[Index].ProjectileInitXSpeed, _costumes[Index].ProjectileInitYSpeed, _costumes[Index].HasSword, _costumes[Index].SwordGravity); EffectsFactory.GetInstance().ChangeTexture(_costumes[Index].EffectsTexture); }
public override void Draw(SpriteBatch spriteBatch) { if (!this.ShouldUpdate) { spriteBatch.Begin(samplerState: SamplerState.PointClamp); ISprite background = BackgroundFactory.GetInstance().CreateProduct(BackgroundTypes.BlackBackground); background.Draw(spriteBatch, new Color(100, 100, 100, 175), Point.Zero); int x = (VirtualWidth - pausedTexture.Width) / 2; int y = (VirtualHeight - pausedTexture.Height) / 5; spriteBatch.Draw(pausedTexture, new Rectangle(x, y, pausedTexture.Width, pausedTexture.Height), Color.White); Texture2D staticMario = ((Sprite) FireMarioFactory.GetInstance().CreateProduct(MarioTypes.IdleRight)).GetTexture(); spriteBatch.Draw(staticMario, new Vector2((float)((VirtualWidth - 96) * 0.5), (float)((VirtualHeight - 200) * 0.6)), new Rectangle(new Point(384, 161), new Point(47, 80)), Color.White, 0, Vector2.Zero, new Vector2(2, 2), SpriteEffects.None, 0f); SpriteFont font = this.Game.Content.Load<SpriteFont>("Font/Mario Game HUD Text"); string name = CostumeChanger.GetInstance().CurrentName(); Texture2D leftButton = Game.Content.Load<Texture2D>("Textures/Left"); Texture2D rightButton = Game.Content.Load<Texture2D>("Textures/Right"); spriteBatch.Draw(leftButton, new Vector2(125, 250), Color.White); spriteBatch.Draw(rightButton, new Vector2(325, 250), Color.White); Vector2 strSize = font.MeasureString(name); int strWidth = (int) Math.Round(strSize.X); int strHeight = (int)Math.Round(strSize.Y); Vector2 position = new Vector2 { X = ((float)(VirtualWidth - strWidth) / 2), Y = ((float)(VirtualHeight - strHeight) / 2) + 125 }; spriteBatch.DrawString(font, string.Format(name), position, Color.White); spriteBatch.End(); } }