public bool CollidesCharacterWithTreasure(MainCharacter character) { int pos = 0; bool collided = false; while (pos < Treasures.Count && !collided) { if (character.CollidesWith(Treasures[pos], XMap, YMap)) { collided = true; Treasures.RemoveAt(pos); } pos++; } return(collided); }