add Target overload for IsInRange

This commit is contained in:
Bob
2010-11-04 00:37:13 +13:00
committed by Chris Forbes
parent ecf41722c3
commit a77b7af5fd
4 changed files with 13 additions and 7 deletions

View File

@@ -234,5 +234,14 @@ namespace OpenRA.Mods.RA
var rsq = range * range * Game.CellSize * Game.CellSize;
return ( attackOrigin - targetLocation ).LengthSquared < rsq;
}
public static bool IsInRange( float2 attackOrigin, float range, Target target )
{
if( !target.IsValid ) return false;
if( target.IsActor )
return IsInRange( attackOrigin, range, target.Actor );
else
return IsInRange( attackOrigin, range, target.CenterLocation );
}
}
}