/// <summary> /// The master sorting algorithm for any collection sprites. /// </summary> public void Sort() { SL.Clear(); foreach (var layerMapItem in LayerMap) { SL.Add(layerMapItem.Value); } foreach (var sprite in DynamicSprites) { SL.Add(sprite); } OrderedLayerMap = SL.OrderBy(x => (x.Coords.X - x.Coords.Y)).ThenBy(x => x.Altitude).ThenBy(x => x.DrawPriority); }