Changed most references of trait Mobile -> IMove.

In Mobile.cs IsMoving now has a public set as opposed to the initial internal. 
Added IMoveInfo interface to go with *Info classes that require IMove.
WithRotor now uses IMove.IsMoving instead of (self.CenterPosition.Z > 0) as part of a check.
This commit is contained in:
Taryn
2014-02-02 01:30:21 -06:00
parent 4b38390907
commit 9c4ad15d1e
13 changed files with 34 additions and 28 deletions

View File

@@ -35,12 +35,12 @@ namespace OpenRA.Mods.RA.Render
IdleAnimating
}
protected bool dirty = false;
Mobile mobile;
RenderInfantryInfo info;
public bool IsMoving { get; set; }
protected bool dirty = false;
string idleSequence;
int idleDelay;
Mobile mobile;
protected virtual string NormalizeInfantrySequence(Actor self, string baseSequence)
{

View File

@@ -34,12 +34,14 @@ namespace OpenRA.Mods.RA.Render
{
WithRotorInfo info;
Animation rotorAnim;
IMove movement;
public WithRotor(Actor self, WithRotorInfo info)
{
this.info = info;
var rs = self.Trait<RenderSprites>();
var body = self.Trait<IBodyOrientation>();
movement = self.Trait<IMove>();
rotorAnim = new Animation(rs.GetImage(self));
rotorAnim.PlayRepeating(info.Sequence);
@@ -50,7 +52,7 @@ namespace OpenRA.Mods.RA.Render
public void Tick(Actor self)
{
var isFlying = self.CenterPosition.Z > 0 && !self.IsDead();
var isFlying = movement.IsMoving && !self.IsDead();
if (isFlying ^ (rotorAnim.CurrentSequence.Name != info.Sequence))
return;

View File

@@ -16,7 +16,7 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA.Render
{
public class WithVoxelWalkerBodyInfo : ITraitInfo, Requires<RenderVoxelsInfo>, Requires<MobileInfo>
public class WithVoxelWalkerBodyInfo : ITraitInfo, Requires<RenderVoxelsInfo>, Requires<IMoveInfo>
{
public readonly int TickRate = 5;
public object Create(ActorInitializer init) { return new WithVoxelWalkerBody(init.self, this); }
@@ -25,14 +25,14 @@ namespace OpenRA.Mods.RA.Render
public class WithVoxelWalkerBody : IAutoSelectionSize, ITick
{
WithVoxelWalkerBodyInfo info;
Mobile mobile;
IMove movement;
int2 size;
uint tick, frame, frames;
public WithVoxelWalkerBody(Actor self, WithVoxelWalkerBodyInfo info)
{
this.info = info;
mobile = self.Trait<Mobile>();
movement = self.Trait<IMove>();
var body = self.Trait<IBodyOrientation>();
var rv = self.Trait<RenderVoxels>();
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA.Render
public void Tick(Actor self)
{
if (mobile.IsMoving)
if (movement.IsMoving)
tick++;
if (tick < info.TickRate)