Example #1
0
        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);
            }
        }