Cooldown

This component allows your prefab to have an advanced cooldown for something else. Essentially this is just a timer with some basic functionality.

Component Cooldown Fields

TypeNameDescription
booleanchargedwhether the cooldown is over
numbercooldown_durationhow long it takes to reach the cooldown
numbercooldown_deadlinehow much time is left
functionstartchargingfnfires when a new cooldown starts. Args: inst
functiononchargedfnfires at the end of a cooldown. Args: inst

Component Cooldown Methods

NameParameterReturnsDescription
StartChargingtimenilstart a new cooldown, optionally with a set time
GetTimeToChargednilnumberit's deadline minus GetTime
IsChargingnilbooleanwhether there prefab is charged or not

Example