public void CopyReference(BrickList copiedFrom, Sprite parent) { int pos = 0; ReadHelper.currentBrickList = this; foreach (Brick brick in Bricks) { if (brick is PointToBrick) { var pointToBrick = brick as PointToBrick; pointToBrick.CopyReference(copiedFrom.Bricks[pos] as PointToBrick, parent); } else if (brick is LoopBeginBrick) { var loopBeginBrick = brick as LoopBeginBrick; loopBeginBrick.CopyReference(copiedFrom.Bricks[pos] as LoopBeginBrick, parent); } else if (brick is LoopEndBrick) { var loopEndBrick = brick as LoopEndBrick; loopEndBrick.CopyReference(copiedFrom.Bricks[pos] as LoopEndBrick, parent); } pos++; } }
public Script(XElement xElement, Sprite parent) { Bricks = new BrickList(parent); sprite = parent; LoadFromCommonXML(xElement); LoadFromXML(xElement); }
public DataObject Copy(Sprite parent) { var newBrickList = new BrickList(parent); ReadHelper.currentBrickList = newBrickList; foreach (Brick brick in Bricks) newBrickList.Bricks.Add(brick.Copy(parent) as Brick); return newBrickList; }
private void LoadFromCommonXML(XElement xRoot) { if (xRoot.Element("brickList") != null) bricks = new BrickList(xRoot.Element("brickList"), sprite); }
public Script(Sprite parent) { Bricks = new BrickList(parent); sprite = parent; }
public Script() { Bricks = new BrickList(null); }