From 67c2da49b10ff152fd296617200368bacae31f91 Mon Sep 17 00:00:00 2001 From: Gabriel Juchault Date: Wed, 21 Nov 2018 13:11:30 +0000 Subject: [PATCH] feat(cooldown-button): add a `StartCooldown` to start cooldown from outside --- Scripts/Controls/CooldownButton.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Scripts/Controls/CooldownButton.cs b/Scripts/Controls/CooldownButton.cs index d1c0e05..56b98f8 100644 --- a/Scripts/Controls/CooldownButton.cs +++ b/Scripts/Controls/CooldownButton.cs @@ -139,6 +139,16 @@ namespace UnityEngine.UI.Extensions } } + /// + /// Start a cooldown from outside + /// + public void StartCooldown() + { + if(OnCooldownStart != null) OnCooldownStart.Invoke(eventData.button); + cooldownTimeRemaining = cooldownTimeout; + cooldownActive = cooldownInEffect = true; + } + /// /// Stop a running Cooldown and reset all values ///