Refactored IQuantizeBodyOrientation implementation

Moved BodyOrientation and related interfaces from Game to Mods.Common.
Introduced QuantizeFacingsFromSequence trait.
With*Body render traits no longer implement IQuantizeBodyOrientation
themselves.
This commit is contained in:
reaperrr
2015-07-13 01:36:42 +02:00
parent 1d3cfcf378
commit 006e66a3c3
17 changed files with 83 additions and 67 deletions

View File

@@ -16,8 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class WithInfantryBodyInfo : UpgradableTraitInfo, IQuantizeBodyOrientationInfo, IRenderActorPreviewSpritesInfo,
Requires<IMoveInfo>, Requires<RenderSpritesInfo>
public class WithInfantryBodyInfo : UpgradableTraitInfo, IRenderActorPreviewSpritesInfo, Requires<IMoveInfo>, Requires<RenderSpritesInfo>
{
public readonly int MinIdleWaitTicks = 30;
public readonly int MaxIdleWaitTicks = 110;
@@ -40,12 +39,6 @@ namespace OpenRA.Mods.Common.Traits
anim.PlayRepeating(RenderSprites.NormalizeSequence(anim, init.GetDamageState(), StandSequences.First()));
yield return new SpriteActorPreview(anim, WVec.Zero, 0, p, rs.Scale);
}
public int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string faction)
{
var rsi = ai.Traits.Get<RenderSpritesInfo>();
return sequenceProvider.GetSequence(rsi.GetImage(ai, sequenceProvider, faction), StandSequences.First()).Facings;
}
}
public class WithInfantryBody : UpgradableTrait<WithInfantryBodyInfo>, ITick, INotifyAttack, INotifyIdle, INotifyCreated