Best way to do sword attacks?

So i made a quick sword attack, but you know how they step forward in games when they attack. What is the best way to do that, I was doing it through code but it got a bit tricky, trying to time it, so I started to use animation, and its ok, but is it a good way to do, will doing it that way give me difficulties later on in development or will coding the step forward while attacking give me more difficulties. When making games, I always had difficulty answering this question.

Thanks
Jakhir

You can use a static trigger for the attack, the animation and camera movement is all fancy work to make it look convincing.