public static Cobweb FromElement(MapElement node) { int x = node.AttrInt("x", 0); int y = node.AttrInt("y", 0); MapElement target = node.SelectFirst("node"); int targetX = target.AttrInt("x", 0); int targetY = target.AttrInt("y", 0); Cobweb entity = new Cobweb(x, y, targetX, targetY); entity.ID = node.AttrInt("id", 0); return(entity); }
public static MovingPlatform FromElement(MapElement node) { int x = node.AttrInt("x", 0); int y = node.AttrInt("y", 0); int width = node.AttrInt("width", 0); MapElement child = node.SelectFirst("node"); Vector2 target = new Vector2(child.AttrInt("x"), child.AttrInt("y")); MovingPlatform entity = new MovingPlatform(width, target); entity.Position = new Vector2(x, y); entity.ID = node.AttrInt("id", 0); return(entity); }
public static Wire FromElement(MapElement node) { int x = node.AttrInt("x", 0); int y = node.AttrInt("y", 0); bool above = node.AttrBool("above", false); MapElement target = node.SelectFirst("node"); int targetX = target.AttrInt("x", 0); int targetY = target.AttrInt("y", 0); Wire entity = new Wire(x, y, targetX, targetY, above); entity.ID = node.AttrInt("id", 0); return(entity); }
public static ZipMover FromElement(MapElement node) { int x = node.AttrInt("x", 0); int y = node.AttrInt("y", 0); int width = node.AttrInt("width", 0); int height = node.AttrInt("height", 0); MapElement target = node.SelectFirst("node"); int targetX = target.AttrInt("x", 0); int targetY = target.AttrInt("y", 0); ZipMover entity = new ZipMover(width, height, targetX, targetY); entity.Position = new Vector2(x, y); entity.ID = node.AttrInt("id", 0); return(entity); }
public static DreamBlock FromElement(MapElement node) { int x = node.AttrInt("x", 0); int y = node.AttrInt("y", 0); int width = node.AttrInt("width", 0); int height = node.AttrInt("height", 0); bool fast = node.AttrBool("fastMoving", false); Vector2 target = new Vector2(x, y); MapElement child = node.SelectFirst("node"); if (child != null) { target = new Vector2(node.AttrInt("x", 0), node.AttrInt("y", 0)); } DreamBlock entity = new DreamBlock(width, height, fast, target); entity.Position = new Vector2(x, y); entity.ID = node.AttrInt("id", 0); return(entity); }