Implements IClickable
Last updated
Was this helpful?
Was this helpful?
Cursor cursor = GuiManager.Cursor;
if (cursor.PrimaryClick && this.HasCursorOver(cursor))
{
// Do something here:
}// At class scope store the selected unit
Unit selectedUnit;
// Perform selection logic every-frame,
void CustomActivity()
{
DoSelectionLogic();
}
void DoSelectionLogic()
{
if(GuiManager.Cursor.PrimaryPush)
{
for(int i = 0; i < UnitList.Count; i++)
{
if(UnitList[i].HasCursorOver(GuiManager.Cursor))
{
selectedUnit = UnitList[i];
break;
}
}
}
}