public bool CollidesCharacterWithItems(MainCharacterA characterA) { int pos = 0; bool collided = false; while (pos < items.Count && !collided) { if (characterA.CollidesWith(items[pos])) { collided = true; items.RemoveAt(pos); } pos++; } return(collided); }
public ushort CollidesCharacterAWith1_UPItem(MainCharacterA characterA) { int pos = 0; ushort result = 0; while (pos < items.Count && result == 0) { if (characterA.CollidesWith(items[pos])) { result += items[pos].Lives; items.RemoveAt(pos); } pos++; } return(result); }