diff --git a/src/Cooldown.cs b/src/Cooldown.cs index 8ad5eca..b0488ab 100644 --- a/src/Cooldown.cs +++ b/src/Cooldown.cs @@ -2,34 +2,37 @@ namespace CooldownAPI { - /// Tutorial and Examples: https://github.com/JosepeDev/CooldownAPI + /// Tutorial and Examples: https://github.com/jozzzzep/CooldownAPI /// /// A class for handling a cooldown in Unity using a timer /// public class Cooldown { - /// Properties: + /// Properties --------------------------------------------------------------------------------- /// - IsActive - Determines if the cooldown is currently active (timer higher than zero) /// - Duration - Returns the value of the default duration of the Cooldown object. /// - Timer - Returns the current value from the cooldown's timer + /// -------------------------------------------------------------------------------------------- /// - /// Events: + /// Events ------------------------------------------------------------------------------------- /// - BecameInactive - An event that is raised when the cooldown becomes inactive + /// -------------------------------------------------------------------------------------------- /// - /// Methods: + /// Methods ------------------------------------------------------------------------------------ /// - Activate() - Activates the cooldown with the default duration saved in the object. /// - Activate(float) - Activates the cooldown with a custom duration. /// - Deactivate() - Resets the timer (deactivates the cooldown). /// - ChangeDuration() - Changes the deafult cooldown duration saved in the object. - - private static CooldownsManager _cdm; - private static CooldownsManager CDM + /// -------------------------------------------------------------------------------------------- + + private static CooldownsManager cooldownsManager; + private static CooldownsManager CooldownsManager { get { - if (_cdm == null) - _cdm = InitializeManager(); - return _cdm; + if (cooldownsManager == null) + cooldownsManager = InitializeManager(); + return cooldownsManager; } } @@ -45,10 +48,14 @@ public Cooldown(float duration) { this.duration = duration; Deactivate(); - CDM.AddToManager(Update); + CooldownsManager.AddToManager(Update); } public delegate void BecameInactiveEventHandler(); + + /// + /// Raised when the cooldown becomes inactive + /// public event BecameInactiveEventHandler BecameInactive; /// @@ -104,9 +111,6 @@ public void Deactivate() public void ChangeDuration(float newDurationValue) => duration = newDurationValue; - /// - /// Used to initialize the cooldowns manager - /// private static CooldownsManager InitializeManager() { var cdm = Object.FindObjectOfType(); @@ -125,9 +129,6 @@ private void OnBecameInactive() e(); } - /// - /// Do not call manually - /// private void Update() { if (isActive) diff --git a/src/CooldownsManager.cs b/src/CooldownsManager.cs index 65ba67c..13402df 100644 --- a/src/CooldownsManager.cs +++ b/src/CooldownsManager.cs @@ -7,7 +7,7 @@ internal class CooldownsManager : MonoBehaviour { /// The class that manages and calls all the cooldowns /// No need to use or call it manually - /// Tutorial and Examples: https://github.com/JosepeDev/CooldownAPI + /// Tutorial and Examples: https://github.com/jozzzzep/CooldownAPI private Action cooldownsUpdates;