public object Compress() { if (_childs[0] is SimpleElement) { SimpleElement compressed = new SimpleElement(); if (currentState.IsDown) { compressed.Turn(); } for (int i = 0; i < 4; i++) { compressed.SetChild(i, _childs[i].Compress()); } return(compressed); } else { Composite compressed = new Composite(); for (int i = 0; i < 4; i++) { compressed.SetChild(i, _childs[i].Compress()); } if (currentState.IsDown) { compressed.Turn(); } return(compressed); } }
public IElement Clone() { IElement clone = new SimpleElement(); if (currentState.IsDown) { clone.Turn(); } return(clone); }