public override DataObject Copy(Sprite parent) { var newBrick = new ChangeBrightnessBrick(parent); newBrick.changeBrightness = changeBrightness; return newBrick; }
public void ScriptBrickCollectionAddBrickTest() { var project = SampleLoader.LoadSampleXML("simple"); Sprite sprite = project.SpriteList.Sprites[1]; ScriptBrickCollection collection = new ScriptBrickCollection(); collection.Update(sprite); Brick insertedBrick1 = new ChangeBrightnessBrick(sprite); Brick insertedBrick2 = new MoveNStepsBrick(sprite); collection.AddScriptBrick(insertedBrick1, 4, 8); collection.AddScriptBrick(insertedBrick2, 1, 6); IEnumerator enumerator = collection.GetEnumerator(); enumerator.MoveNext(); Assert.IsTrue(enumerator.Current is StartScript); enumerator.MoveNext(); Assert.IsTrue(enumerator.Current is SetCostumeBrick); enumerator.MoveNext(); Assert.IsTrue(enumerator.Current is MoveNStepsBrick); enumerator.MoveNext(); Assert.IsTrue(enumerator.Current is WhenScript); enumerator.MoveNext(); Assert.IsTrue(enumerator.Current is SetCostumeBrick); enumerator.MoveNext(); Assert.IsTrue(enumerator.Current is WaitBrick); enumerator.MoveNext(); Assert.IsTrue(enumerator.Current is SetCostumeBrick); enumerator.MoveNext(); Assert.IsTrue(enumerator.Current is WaitBrick); enumerator.MoveNext(); Assert.IsTrue(enumerator.Current is SetCostumeBrick); enumerator.MoveNext(); Assert.IsTrue(enumerator.Current is ChangeBrightnessBrick); Assert.IsFalse(enumerator.MoveNext()); }