Creating a Cooldown System
<p>Creating a cooldown system is a lot simpler than you think.</p>
<p>First things first, you need to create your variable within your code so Unity knows what you are trying to do.</p>
<p>Typically you are going to have 2 variables that have important roles when creating your cool down; the fire rate which dictates how quickly you fire and the “can fire” rate that dictates how often you fire.</p>
<p>Both of these variables will be private but the fire rate will be a serialized field so you can edit as you go in the Unity Inspector.</p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:403/1*OpTAEH2xOwyY9JFFWOMEgg.png" style="height:94px; width:366px" /></p>
<p>Now let’s get into the actual code of creating a cooldown system. You will utilize [Time.time], which is how long the game has been running in seconds, and your _canFire code you created earlier. Here’s what that should look like:</p>
<p>Read More<a href="https://medium.com/@jmick.work23/creating-a-cooldown-system-7c4baf89d45c">https://medium.com/@jmick.work23/creating-a-cooldown-system-7c4baf89d45c</a></p>