Beispiel #1
0
        void UpdateRenderedSpriteInner(CPos cell, RendererCellContents content)
        {
            if (content.Density > 0)
            {
                var clear = FindClearSides(cell, content.Type);

                if (clear == ClearSides.None)
                {
                    var maxDensity = ResourceLayer.GetMaxDensity(content.Type);
                    var index      = content.Density > maxDensity / 2 ? 1 : 0;
                    UpdateSpriteLayers(cell, content.Sequence, index, content.Palette);
                }
                else if (SpriteMap.TryGetValue(clear, out var index))
                {
                    UpdateSpriteLayers(cell, content.Sequence, index, content.Palette);
                }
                else
                {
                    throw new InvalidOperationException($"SpriteMap does not contain an index for ClearSides type '{clear}'");
                }
            }
            else
            {
                UpdateSpriteLayers(cell, null, 0, null);
            }
        }