IEnumerable <Renderable> SpritesToRender() { var bounds = Game.viewport.WorldBounds(world); var comparer = new SpriteComparer(); var actors = world.FindUnits( new int2(Game.CellSize * bounds.Left, Game.CellSize * bounds.Top), new int2(Game.CellSize * bounds.Right, Game.CellSize * bounds.Bottom)); var renderables = actors.SelectMany(a => a.Render()) .OrderBy(r => r, comparer); var effects = world.Effects.SelectMany(e => e.Render()); return(renderables.Concat(effects)); }
IEnumerable <Renderable> SpritesToRender() { var bounds = Game.viewport.WorldBounds(world); var comparer = new SpriteComparer(); var actors = world.FindUnits( bounds.TopLeftAsCPos().ToPPos(), bounds.BottomRightAsCPos().ToPPos() ); var renderables = actors.SelectMany(a => a.Render()) .OrderBy(r => r, comparer); var effects = world.Effects.SelectMany(e => e.Render()); return(renderables.Concat(effects)); }