Add ActorInfo.TraitInfo[OrDefault]<T>() requiring ITraitIfo types
This commit is contained in:
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public IEnumerable<VoxelAnimation> RenderPreviewVoxels(ActorPreviewInitializer init, RenderVoxelsInfo rv, string image, WRot orientation, int facings, PaletteReference p)
|
||||
{
|
||||
var body = init.Actor.Traits.Get<BodyOrientationInfo>();
|
||||
var body = init.Actor.TraitInfo<BodyOrientationInfo>();
|
||||
var voxel = VoxelProvider.GetVoxel(image, "idle");
|
||||
var bodyOrientation = new[] { body.QuantizeOrientation(orientation, facings) };
|
||||
yield return new VoxelAnimation(voxel, () => WVec.Zero,
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
() => IsTraitDisabled, () => 0));
|
||||
|
||||
// Selection size
|
||||
var rvi = self.Info.Traits.Get<RenderVoxelsInfo>();
|
||||
var rvi = self.Info.TraitInfo<RenderVoxelsInfo>();
|
||||
var s = (int)(rvi.Scale * voxel.Size.Aggregate(Math.Max));
|
||||
size = new int2(s, s);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user