CooldownComponent
Declaration
public class Strawberry.Components.Lifecycle.CooldownComponent
Implements a mechanism to manage cooldowns for actions, such as shooting a gun or jumping.
Inherits: Strawberry.Core.BaseComponent
Methods
Start
Starts the cooldown process for the key provided, if the key exists, it will reset the cooldown timer to the given time.
void Start(string key, float time)
Parameters:
| Name | Type | Description |
|---|---|---|
key |
System.String |
|
time |
System.Single |
IsReady
Returns whether the provided action (key) is ready.
bool IsReady(string key)
Parameters:
| Name | Type | Description |
|---|---|---|
key |
System.String |
The key of the action |
Returns: True if the action is ready, false otherwise
GetRemaining
Gets the remaining time for a given action
float GetRemaining(string key)
Parameters:
| Name | Type | Description |
|---|---|---|
key |
System.String |
The key of the action |
Returns: The remaining time for the action
Cancel
Cancels a given action, making it ready to be used again.
void Cancel(string key)
Parameters:
| Name | Type | Description |
|---|---|---|
key |
System.String |
The key of the action |
OnUpdate override
void OnUpdate()