public void UpdateTerrain(TerrainSelector selector) { var componentRenders = GetRenderableTerrain(selector); var renders = new List <TerrainRender>(); foreach (var render in componentRenders) { renders.AddRange(render.Terrain.Select(layer => new TerrainRender(layer, render.Color))); } _renders = renders.OrderBy(render => render.Layer.Order).ToList(); }
public IEnumerable <ComponentRender> GetRenderableTerrain(TerrainSelector selector) { foreach (var component in Components) { if (selector.IsValid(component)) { foreach (var render in component.GetTerrain()) { yield return(selector.TransformRender(this, component, render)); } } } }