Cleaner access to InitialFacing and ROT

This commit is contained in:
Paul Chote
2010-07-31 21:55:49 +12:00
parent 765bedb592
commit 88cb942430
5 changed files with 8 additions and 9 deletions

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Traits.Activities
public IActivity Tick( Actor self )
{
var unit = self.traits.Get<Unit>();
var ROT = self.traits.WithInterface<IMove>().FirstOrDefault().ROT(self);
var ROT = self.traits.Get<IMove>().ROT;
if( desiredFacing == unit.Facing )
return NextActivity;

View File

@@ -91,9 +91,8 @@ namespace OpenRA.Traits
}
}
public int ROT(Actor self){ return Info.ROT; }
public int InitialFacing(Actor self){ return Info.InitialFacing; }
public int ROT { get { return Info.ROT; } }
public int InitialFacing { get { return Info.InitialFacing; } }
public void SetPosition(Actor self, int2 cell)
{

View File

@@ -46,7 +46,7 @@ namespace OpenRA.Traits
public virtual int CreationFacing( Actor self, Actor newUnit )
{
return newUnit.traits.Get<IMove>().InitialFacing(newUnit);
return newUnit.traits.Get<IMove>().InitialFacing;
}
public virtual bool Produce( Actor self, ActorInfo producee )

View File

@@ -110,8 +110,8 @@ namespace OpenRA.Traits
float MovementCostForCell(Actor self, int2 cell);
float MovementSpeedForCell(Actor self, int2 cell);
IEnumerable<float2> GetCurrentPath(Actor self);
int ROT(Actor self);
int InitialFacing(Actor self);
int ROT { get; }
int InitialFacing { get; }
}
public interface IOffsetCenterLocation { float2 CenterOffset { get; } }

View File

@@ -45,9 +45,9 @@ namespace OpenRA.Mods.RA
get { return Location; }
}
public int ROT(Actor self){ return Info.ROT; }
public int ROT { get { return Info.ROT; } }
public int InitialFacing(Actor self){ return Info.InitialFacing; }
public int InitialFacing { get { return Info.InitialFacing; } }
public void SetPosition(Actor self, int2 cell)
{