You need to be less rigid in how you are approaching the problem. Right now you’re thinking “I have this function that fires, so if I want burst fire I’ll just fire it three times” rather than “I have these pieces how do I use it to make something burst-y”. As Rumble said, you need to add NEW logic and not re-use the same thing.
You could take those pieces and do something like this:
FTimerHandle BurstHandle; // New handle for Burst functionality.
int BurstCount; // Expose this to BP or whatever.
void BurstFire()
{
PullTrigger();
BurstFire = FMath::Max(BurstFire - 1, 0); // Clamp us to never dropping below 0.
if (BurstFire > 0) // Do we still need to fire more?
{
GetWorld()->GetTimerManager().SetTimer(BurstHandle, this, &AGun::BurstFire, BurstDelay, false);
}
}
tl;dr - Less copy and paste coding, more understanding what your code is doing so you can better manipulate it.