
Untitled
By: a guest on
May 20th, 2012 | syntax:
C# | size: 1.76 KB | hits: 24 | expires: Never
class Program
{
private static UnitType _unitType;
static void Main(string[] args)
{
if(args != null)
{
if(!Enum.TryParse(args[0], out _unitType))
{
Game.Print(string.Format("Could not parse {0} as a unit type allowed unit types are: ", args[0]));
foreach(var type in Enum.GetNames(typeof(UnitType)))
{
Game.Print(type);
}
return;
}
}
else
{
Game.Print("No unit type provided");
return;
}
Game.OnDrawEvent += GameOnOnDrawEvent;
}
private static void GameOnOnDrawEvent(EventArgs eventArgs)
{
if (Game.Ingame)
{
int counter = 0;
var gizmos = Unit.Get().Where(x => x.Type == _unitType).ToArray();
foreach (var gizmo in gizmos)
{
if (gizmo.Name.StartsWith("!!"))
continue;
var text = string.Format(
"{0}. {1}, ActorID = {2}, Range = {3}",
counter,
gizmo.Name.Replace("\n", ""),
gizmo.ActorId,
Range(gizmo)
);
Draw.DrawText(10.0f, 10.0f + 27.0f * counter++, 0x16A, 0x16, 0xFFFFFFFF, text);
}
}
}
private static float Range(Unit unit)
{
return (float)Math.Sqrt(Math.Pow(Me.X - unit.X, 2) + Math.Pow(Me.Y - unit.Y, 2));
}
}