Convert ChronoshiftPower to world coords.
This commit is contained in:
@@ -51,6 +51,7 @@ namespace OpenRA
|
||||
|
||||
public float2 ToFloat2() { return new float2(X, Y); }
|
||||
public int2 ToInt2() { return new int2(X, Y); }
|
||||
public WVec ToWVec() { return new WVec(X*1024, Y*1024, 0); }
|
||||
|
||||
public CVec Clamp(Rectangle r)
|
||||
{
|
||||
|
||||
@@ -242,19 +242,22 @@ namespace OpenRA.Mods.RA
|
||||
// Unit previews
|
||||
foreach (var unit in power.UnitsInRange(sourceLocation))
|
||||
{
|
||||
var offset = (xy - sourceLocation).ToWVec();
|
||||
if (manager.self.Owner.Shroud.IsTargetable(unit))
|
||||
foreach (var r in unit.Render(wr))
|
||||
r.WithPxOffset((xy.ToPPos() - sourceLocation.ToPPos()).ToFloat2()).Render(wr);
|
||||
r.WithPos(r.Pos + offset).Render(wr);
|
||||
}
|
||||
|
||||
// Unit tiles
|
||||
foreach (var unit in power.UnitsInRange(sourceLocation))
|
||||
{
|
||||
if (manager.self.Owner.Shroud.IsTargetable(unit)) {
|
||||
if (manager.self.Owner.Shroud.IsTargetable(unit))
|
||||
{
|
||||
var targetCell = unit.Location + (xy - sourceLocation);
|
||||
var canEnter = ((manager.self.Owner.Shroud.IsExplored(targetCell) || manager.self.Owner.HasFogVisibility())&& unit.Trait<Chronoshiftable>().CanChronoshiftTo(unit,targetCell));
|
||||
var canEnter = ((manager.self.Owner.Shroud.IsExplored(targetCell) || manager.self.Owner.HasFogVisibility()) &&
|
||||
unit.Trait<Chronoshiftable>().CanChronoshiftTo(unit,targetCell));
|
||||
var tile = canEnter ? validTile : invalidTile;
|
||||
tile.DrawAt( wr, targetCell.ToPPos().ToFloat2(), "terrain" );
|
||||
tile.DrawAt(wr, targetCell.ToPPos().ToFloat2(), "terrain");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user