Changed code to use object initializers everywhere

This commit is contained in:
penev92
2022-01-20 01:07:24 +02:00
committed by abcdefg30
parent 70e2769a85
commit ab09ce21b4
9 changed files with 58 additions and 31 deletions

View File

@@ -66,8 +66,11 @@ namespace OpenRA.Mods.Common.Traits.Render
facing = () => f;
}
var anim = new Animation(init.World, Image ?? image, facing);
anim.IsDecoration = IsDecoration;
var anim = new Animation(init.World, Image ?? image, facing)
{
IsDecoration = IsDecoration
};
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), Sequence));
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
@@ -94,8 +97,11 @@ namespace OpenRA.Mods.Common.Traits.Render
var body = self.Trait<BodyOrientation>();
var image = info.Image ?? rs.GetImage(self);
overlay = new Animation(self.World, image, () => IsTraitPaused);
overlay.IsDecoration = info.IsDecoration;
overlay = new Animation(self.World, image, () => IsTraitPaused)
{
IsDecoration = info.IsDecoration
};
if (info.StartSequence != null)
overlay.PlayThen(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.StartSequence),
() => overlay.PlayRepeating(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.Sequence)));