@@ -10,12 +10,11 @@ public sealed class BuildingRenderer : ObjectRenderer<Structure>
1010 {
1111 public BuildingRenderer ( RenderDependencies renderDependencies ) : base ( renderDependencies )
1212 {
13- buildingAnimRenderer = new AnimRenderer ( renderDependencies ) ;
1413 }
1514
1615 protected override Color ReplacementColor => Color . Yellow ;
1716
18- private AnimRenderer buildingAnimRenderer ;
17+ private List < Animation > animationList = new List < Animation > ( ) ;
1918
2019 DepthRectangle cachedDepth ;
2120
@@ -302,22 +301,22 @@ protected override void Render(Structure gameObject, Point2D drawPoint, in Commo
302301 float depthAddition = Constants . DepthEpsilon * ObjectDepthAdjustments . Building ;
303302
304303 // Form the anims list
305- var animsList = new List < Animation > ( gameObject . Anims . Length + gameObject . PowerUpAnims . Length + 1 ) ;
306- animsList . AddRange ( gameObject . Anims ) ;
307- animsList . AddRange ( gameObject . PowerUpAnims ) ;
304+ animationList . Clear ( ) ;
305+ animationList . AddRange ( gameObject . Anims ) ;
306+ animationList . AddRange ( gameObject . PowerUpAnims ) ;
308307 if ( gameObject . TurretAnim != null )
309- animsList . Add ( gameObject . TurretAnim ) ;
310-
308+ animationList . Add ( gameObject . TurretAnim ) ;
309+
311310 // Sort the anims according to their settings
312- animsList . Sort ( ( anim1 , anim2 ) =>
311+ animationList . Sort ( ( anim1 , anim2 ) =>
313312 anim1 . BuildingAnimDrawConfig . SortValue . CompareTo ( anim2 . BuildingAnimDrawConfig . SortValue ) ) ;
314313
315314 bool affectedByAmbient = ! affectedByLighting ;
316315
317316 // The building itself has an offset of 0, so first draw all anims with sort values < 0
318- for ( int i = 0 ; i < animsList . Count ; i ++ )
317+ for ( int i = 0 ; i < animationList . Count ; i ++ )
319318 {
320- var anim = animsList [ i ] ;
319+ var anim = animationList [ i ] ;
321320
322321 if ( anim . BuildingAnimDrawConfig . SortValue < 0 )
323322 {
@@ -348,9 +347,9 @@ protected override void Render(Structure gameObject, Point2D drawPoint, in Commo
348347 DrawFoundationLines ( gameObject ) ;
349348
350349 // Then draw all anims with sort values >= 0
351- for ( int i = 0 ; i < animsList . Count ; i ++ )
350+ for ( int i = 0 ; i < animationList . Count ; i ++ )
352351 {
353- var anim = animsList [ i ] ;
352+ var anim = animationList [ i ] ;
354353
355354 if ( anim . BuildingAnimDrawConfig . SortValue >= 0 )
356355 {
0 commit comments