Is he flirting just like that or implying he wants an affair?

The dude in question is taken but I found out rather lately. He's been complimenting me, wanting more time together, blushing, being nervous but also cocky, staring at me, giving me a lot of attention and kind of caring for me. When I was somewhere in his sight, he would stare at me, "accidentally" be there too, he mimicks my gestures, words and painstakingly tries to find common qualities about us. Sometimes he's a bit cold, sometimes super super nice and overly funny. Sometimes he writes in the evening, sometimes he doesn't reply to me at all. Often he still looks at me for a long time and just smiles silently.

I was not very convinced of his intentions since I suspected he could not be free.
Also, I just tried to not take all of that seriously. But he seemed annoyed with me a few times which he didn't make me feel on purpose, but he definitely was pissed when I didn't acknowledge him trying to impress or contact me. Well, and now that he made it clear to me that he's actually taken, and he did so in an awkward way as if making an excuse or something, I'm just wondering if he actually was indeed trying to have an affair with me.
It just changes my perception of him and it would be good to know more about what kind of person he is in order to deal with him. Sure I like him and find him attractive, so I'm disappointed. But I wouldn't ever be anyone's affair. If he actually was trying to get me to do that, I don't approve of it at all.
Is he flirting just like that or implying he wants an affair?
Add Opinion