public void ParseOffsets(ObjectInstance instance, Layer layer, Board board, int x, int y) { List <FootholdAnchor> anchors = new List <FootholdAnchor>(); bool ladder = l0 == "ladder"; if (footholdOffsets != null || footholdFullOffsets != null) { if (!fullFootholdInfo) { foreach (XNA.Point foothold in footholdOffsets) { FootholdAnchor anchor = new FootholdAnchor(board, x + foothold.X, y + foothold.Y, layer.LayerNumber, false); board.BoardItems.FHAnchors.Add(anchor); instance.BindItem(anchor, foothold); anchors.Add(anchor); } CreateFootholdsFromAnchorList(board, anchors); } else { foreach (List <XNA.Point> anchorList in footholdFullOffsets) { foreach (XNA.Point foothold in anchorList) { FootholdAnchor anchor = new FootholdAnchor(board, x + foothold.X, y + foothold.Y, layer.LayerNumber, false); board.BoardItems.FHAnchors.Add(anchor); instance.BindItem(anchor, foothold); anchors.Add(anchor); } CreateFootholdsFromAnchorList(board, anchors); anchors.Clear(); } } } if (chairOffsets != null) { foreach (XNA.Point chairPos in chairOffsets) { Chair chair = new Chair(board, x + chairPos.X, y + chairPos.Y, false); board.BoardItems.Chairs.Add(chair); instance.BindItem(chair, chairPos); } } /*foreach (XNA.Point rope in ropeOffsets) //second thought: what the f**k is this even good for? rope origins aren't multilined anyway, why add them as board items? * { * RopeLadderAnchor ropeAnchor = new RopeLadderAnchor(board, x + rope.X, y + rope.Y, layer.LayerNumber, ladder, false); * board.BoardItems.RopeAnchors.Add(ropeAnchor); * instance.BindItem(ropeAnchor, rope); * }*/ }
public void ParseOffsets(ObjectInstance instance, Layer layer, Board board, int x, int y) { List<FootholdAnchor> anchors = new List<FootholdAnchor>(); bool ladder = l0 == "ladder"; if (footholdOffsets != null || footholdFullOffsets != null) { if (!fullFootholdInfo) { foreach (XNA.Point foothold in footholdOffsets) { FootholdAnchor anchor = new FootholdAnchor(board, x + foothold.X, y + foothold.Y, layer.LayerNumber, false); board.BoardItems.FHAnchors.Add(anchor); instance.BindItem(anchor, foothold); anchors.Add(anchor); } CreateFootholdsFromAnchorList(board, anchors); } else { foreach (List<XNA.Point> anchorList in footholdFullOffsets) { foreach (XNA.Point foothold in anchorList) { FootholdAnchor anchor = new FootholdAnchor(board, x + foothold.X, y + foothold.Y, layer.LayerNumber, false); board.BoardItems.FHAnchors.Add(anchor); instance.BindItem(anchor, foothold); anchors.Add(anchor); } CreateFootholdsFromAnchorList(board, anchors); anchors.Clear(); } } } if (chairOffsets != null) foreach (XNA.Point chairPos in chairOffsets) { Chair chair = new Chair(board, x + chairPos.X, y + chairPos.Y, false); board.BoardItems.Chairs.Add(chair); instance.BindItem(chair, chairPos); } /*foreach (XNA.Point rope in ropeOffsets) //second thought: what the f**k is this even good for? rope origins aren't multilined anyway, why add them as board items? { RopeLadderAnchor ropeAnchor = new RopeLadderAnchor(board, x + rope.X, y + rope.Y, layer.LayerNumber, ladder, false); board.BoardItems.RopeAnchors.Add(ropeAnchor); instance.BindItem(ropeAnchor, rope); }*/ }