Creating A Cooldown System in Unity

George Asiedu
Aug 10, 2022

in most shoot’em up style games there is some control to the rate of fire. The example above would suit a rapid fire power up but what if we want to control it or slow it down.

to control the rate of fire we will need a variable to recognise it

then we want to check that when the space key is pressed the time passed is greater than a variable which we will call “_canfire”.

this if statement will control both these conditions through “&&” operator which carries out the command if both check conditions are made

when “time.time” is greater than “_canfire” we can the laser

--

--