public void Merge(BlockGroup group, Translation lastTranslation) { if (group.Overlaps(core)) { group.Translate(lastTranslation.Negate()); core.Merge(group); } }
[Test] public void ShouldMoveAllTheBlocksFromOneGroupIntoTheOther() { List <Block> fruit = new List <Block>() { CreateBlock(1, 1) }; List <Block> vegetables = new List <Block>() { CreateBlock(1, 2) }; BlockGroup fruitGroup = new BlockGroup(fruit, movement, merging); BlockGroup vegetableGroup = new BlockGroup(vegetables, movement, merging); fruitGroup.Merge(vegetableGroup); Assert.That(fruit.Count, Is.EqualTo(2)); Assert.That(vegetables.Count, Is.EqualTo(0)); }