Check this article on a different approach and with some explanations on the matter:
Your issue thou, is that the loop is really fast and SetTimer is being overwritten twice, so only the last one is valid. You will want to use the example with the article above with a Delegate which will do a Pew and at the end it will restart the timer controlling how many times that happen, so you will use a counter to control that.
Pretty close there, but you should only set the timer if there’s any more left to fire. Otherwise, you’ve got this timer firing every 0.1 seconds forever.
I’d go with something like
BurstCounter = BurstNumberOfBullets;
...
if (BurstCounter-- > 0) {
FireFunctionality();
if (BurstCounter > 0) {
...Set new timer
}
}