Reorganize IBodyOrientation.
This commit is contained in:
@@ -49,8 +49,6 @@ namespace OpenRA.Mods.RA.Render
|
||||
this.info = info;
|
||||
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
|
||||
|
||||
self.Trait<IBodyOrientation>().SetAutodetectedFacings(DefaultAnimation.CurrentSequence.Facings);
|
||||
}
|
||||
|
||||
public virtual void BuildingComplete(Actor self)
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -25,6 +27,11 @@ namespace OpenRA.Mods.RA.Render
|
||||
public readonly string[] StandAnimations = { "stand" };
|
||||
|
||||
public override object Create(ActorInitializer init) { return new RenderInfantry(init.self, this); }
|
||||
|
||||
public override int QuantizedBodyFacings(SequenceProvider sequenceProvider, ActorInfo ai)
|
||||
{
|
||||
return sequenceProvider.GetSequence(RenderSprites.GetImage(ai), StandAnimations.First()).Facings;
|
||||
}
|
||||
}
|
||||
|
||||
public class RenderInfantry : RenderSimple, INotifyAttack, INotifyKilled, INotifyIdle
|
||||
@@ -64,8 +71,6 @@ namespace OpenRA.Mods.RA.Render
|
||||
DefaultAnimation.PlayFetchIndex(NormalizeInfantrySequence(self, info.StandAnimations.Random(Game.CosmeticRandom)), () => 0);
|
||||
State = AnimationState.Waiting;
|
||||
move = self.Trait<IMove>();
|
||||
|
||||
self.Trait<IBodyOrientation>().SetAutodetectedFacings(DefaultAnimation.CurrentSequence.Facings);
|
||||
}
|
||||
|
||||
public void Attacking(Actor self, Target target)
|
||||
|
||||
@@ -15,7 +15,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
public class RenderSimpleInfo : RenderSpritesInfo, ILegacyEditorRenderInfo, Requires<IBodyOrientationInfo>
|
||||
public class RenderSimpleInfo : RenderSpritesInfo, IQuantizeBodyOrientationInfo, ILegacyEditorRenderInfo, Requires<IBodyOrientationInfo>
|
||||
{
|
||||
public override object Create(ActorInitializer init) { return new RenderSimple(init.self); }
|
||||
|
||||
@@ -27,6 +27,11 @@ namespace OpenRA.Mods.RA.Render
|
||||
return anim.Render(WPos.Zero, WVec.Zero, 0, pr, Scale);
|
||||
}
|
||||
|
||||
public virtual int QuantizedBodyFacings(SequenceProvider sequenceProvider, ActorInfo ai)
|
||||
{
|
||||
return sequenceProvider.GetSequence(RenderSprites.GetImage(ai), "idle").Facings;
|
||||
}
|
||||
|
||||
public string EditorPalette { get { return Palette; } }
|
||||
public string EditorImage(ActorInfo actor) { return RenderSimple.GetImage(actor); }
|
||||
}
|
||||
@@ -46,7 +51,6 @@ namespace OpenRA.Mods.RA.Render
|
||||
: this(self, MakeFacingFunc(self))
|
||||
{
|
||||
DefaultAnimation.PlayRepeating(NormalizeSequence(self, "idle"));
|
||||
self.Trait<IBodyOrientation>().SetAutodetectedFacings(DefaultAnimation.CurrentSequence.Facings);
|
||||
}
|
||||
|
||||
public int2 SelectionSize(Actor self) { return AutoSelectionSize(self); }
|
||||
|
||||
4
OpenRA.Mods.RA/Render/WithVoxelBody.cs
Executable file → Normal file
4
OpenRA.Mods.RA/Render/WithVoxelBody.cs
Executable file → Normal file
@@ -16,11 +16,13 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
[Desc("Also returns a default selection size that is calculated automatically from the voxel dimensions.")]
|
||||
public class WithVoxelBodyInfo : ITraitInfo, Requires<RenderVoxelsInfo>
|
||||
public class WithVoxelBodyInfo : ITraitInfo, IQuantizeBodyOrientationInfo, Requires<RenderVoxelsInfo>
|
||||
{
|
||||
public readonly string Sequence = "idle";
|
||||
|
||||
public object Create(ActorInitializer init) { return new WithVoxelBody(init.self, this); }
|
||||
|
||||
public int QuantizedBodyFacings(SequenceProvider sequenceProvider, ActorInfo ai) { return 0; }
|
||||
}
|
||||
|
||||
public class WithVoxelBody : IAutoSelectionSize
|
||||
|
||||
Reference in New Issue
Block a user