public static GameObject CheckBackgroundObjects(Entity entity) { switch (entity.Type) { case "SmallHill": return(new BackgroundObject(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), BackgroundTypes.SmallHill)); case "BigHill": return(new BackgroundObject(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), BackgroundTypes.BigHill)); case "SmallBush": return(new BackgroundObject(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), BackgroundTypes.SmallBush)); case "BigBush": return(new BackgroundObject(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), BackgroundTypes.BigBush)); case "SmallCloud": return(new BackgroundObject(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), BackgroundTypes.SmallCloud)); case "BigCloud": return(new BackgroundObject(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), BackgroundTypes.BigCloud)); case "SmallTree": return(new BackgroundObject(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), BackgroundTypes.SmallTree)); case "BigTree": return(new BackgroundObject(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), BackgroundTypes.BigTree)); case "Black": return(new BackgroundObject(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), BackgroundTypes.BlackBackground)); case "Castle": return(new BackgroundObject(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), BackgroundTypes.Castle)); case "Flag": return(new Flag(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y))); case "Flag Segment 1": return(new FlagSegment(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), 200)); case "Flag Segment 2": return(new FlagSegment(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), 400)); case "Flag Segment 3": return(new FlagSegment(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), 600)); case "Flag Segment 4": return(new FlagSegment(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), 800)); case "Flag Segment 5": return(new FlagSegment(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), 1000)); case "Flag Segment 6": return(new FlagSegment(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), 1200)); default: return(null); } }
public static GameObject CheckBlocks(Entity entity) { switch (entity.Type) { case "BrickBlock": return(new BrickBlock(BlockFactory.GetInstance(), new Point(entity.X, entity.Y))); case "FloorBlock": return(new FloorBlock(BlockFactory.GetInstance(), new Point(entity.X, entity.Y))); case "HiddenBlock": GameObject block = new QuestionBlock(BlockFactory.GetInstance(), new Point(entity.X, entity.Y)); return(new HiddenBlock((Block)block)); case "PyramidBlock": return(new PyramidBlock(BlockFactory.GetInstance(), new Point(entity.X, entity.Y))); case "QuestionBlock": return(new QuestionBlock(BlockFactory.GetInstance(), new Point(entity.X, entity.Y))); case "Pipe": return(new SmallPipe(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), new Vector2())); case "CopperPipe": GameObject obj = new SmallPipe(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), new Vector2()); obj.Sprite = BackgroundFactory.GetInstance().CreateProduct(BackgroundTypes.CopperPipe); return(obj); case "MediumPipe": return(new MediumPipe(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), new Vector2())); case "PipeSegment": return(new PipeSegment(BackgroundFactory.GetInstance(), new Point(entity.X, entity.Y), new Vector2())); case "Win Block": return(new WinBlock(BlockFactory.GetInstance(), new Point(entity.X, entity.Y))); case "Gate": return(new Gate(BlockFactory.GetInstance(), new Point(entity.X, entity.Y))); case "Button": return(new Button(BlockFactory.GetInstance(), new Point(entity.X, entity.Y))); case "InvertedButton": return(new Button(true, BlockFactory.GetInstance(), new Point(entity.X, entity.Y))); case "CompanionCube": return(new CompanionCube(BlockFactory.GetInstance(), new Point(entity.X, entity.Y))); default: return(null); } }
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(); } }