Changed code to use object initializers everywhere
This commit is contained in:
@@ -42,8 +42,11 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
var rs = self.Trait<RenderSprites>();
|
||||
var body = self.Trait<BodyOrientation>();
|
||||
|
||||
anim = new Animation(self.World, rs.GetImage(self), RenderSprites.MakeFacingFunc(self));
|
||||
anim.IsDecoration = true;
|
||||
anim = new Animation(self.World, rs.GetImage(self), RenderSprites.MakeFacingFunc(self))
|
||||
{
|
||||
IsDecoration = true
|
||||
};
|
||||
|
||||
anim.Play(info.Sequence);
|
||||
rs.Add(new AnimationWithOffset(anim,
|
||||
() => body.LocalToWorld(info.LocalOffset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -66,11 +66,13 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
object IAssignSpawnPointsInfo.InitializeState(MapPreview map, Session lobbyInfo)
|
||||
{
|
||||
var state = new AssignSpawnLocationsState();
|
||||
var state = new AssignSpawnLocationsState
|
||||
{
|
||||
// Initialize the list of unoccupied spawn points for AssignSpawnLocations to pick from
|
||||
SpawnLocations = map.SpawnPoints,
|
||||
AvailableSpawnPoints = LobbyUtils.AvailableSpawnPoints(map.SpawnPoints.Length, lobbyInfo)
|
||||
};
|
||||
|
||||
// Initialize the list of unoccupied spawn points for AssignSpawnLocations to pick from
|
||||
state.SpawnLocations = map.SpawnPoints;
|
||||
state.AvailableSpawnPoints = LobbyUtils.AvailableSpawnPoints(map.SpawnPoints.Length, lobbyInfo);
|
||||
foreach (var kv in lobbyInfo.Slots)
|
||||
{
|
||||
var client = lobbyInfo.ClientInSlot(kv.Key);
|
||||
|
||||
Reference in New Issue
Block a user