Hi.
MY SITUATION…
I’m building a game that has many weapons, some of them are automatic weapons other ones are not.
With ‘automatic weapons’ i mean all those weapons that shoot automaticallywhile the LeftMouseButton is held down.
Now, ANY weapon has its own FireRate
For automatic weapons, the FireRate is the interval between a shot and another (while the button is held down).
For ‘manual’ weapons, the FireRate is the interval between a shot and another (but requires the Player to click the button again)
How can I introduce this concept in my game?
I’ve already created a boolean variable bIsAutomatic in order to distinguish an automatic weapons from a manual one.
Now, the base class of ANY weapon in the game is Weapon, and derives from AActor
The latter has a virtual method called Fire() which performs the fire action.
**
HERE IS THE PROBLEM NOW…
**
Now I’d like to know how to implement this concept.
Obviously there should be an If-Statement
if(bIsAutomatic)
{ … }
else
{ … }
Mhm, with that said: how can I make the automatic weapons shoot while the button is pressed with a delay of X and how can I make the manual weapons shoot once the button is pressed?