Convert this LUA script into C#:

function OnOrder(order, target)
  local state = GetState()
  if state == AI_HALTED then
    return
  end
  if order == ORDER_ATTACKTO then
    OutOfCombatRegen:Stop()
    SetStateAndCloseToTarget(AI_ATTACK, target)
    SetRoamState(HOSTILE)
    return true
  else
    Error("Unsupported Order")
    return false
  end
end Avoid using the following keywords: return, end, lua, getstate
user