Change Exit.SpawnOffsetVector to WVec.

This commit is contained in:
Paul Chote
2013-07-21 10:08:48 +12:00
parent ac3f63b59c
commit 36a45d1a3f
4 changed files with 9 additions and 10 deletions

View File

@@ -31,13 +31,15 @@ namespace OpenRA.Mods.RA
public class ExitInfo : TraitInfo<Exit>
{
public readonly int2 SpawnOffset = int2.Zero; // in px relative to CenterLocation
public readonly int2 ExitCell = int2.Zero; // in cells relative to TopLeft
public readonly int2 ExitCell = int2.Zero; // in cells relative to TopLeft
public readonly int Facing = -1;
public PVecInt SpawnOffsetVector { get { return (PVecInt)SpawnOffset; } }
// TODO: Push this conversion into the yaml
public WVec SpawnOffsetVector { get { return new WVec(SpawnOffset.X, SpawnOffset.Y, 0) * 1024 / Game.CellSize; } }
public CVec ExitCellVector { get { return (CVec)ExitCell; } }
}
public class Exit {}
public class Exit { }
public class Production
{
@@ -50,7 +52,7 @@ namespace OpenRA.Mods.RA
public void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo)
{
var exit = self.Location + exitinfo.ExitCellVector;
var spawn = (self.Trait<IHasLocation>().PxPosition + exitinfo.SpawnOffsetVector).ToWPos(0);
var spawn = self.CenterPosition + exitinfo.SpawnOffsetVector;
var to = exit.CenterPosition;
var fi = producee.Traits.Get<IFacingInfo>();