Merged in gjuchault/unity-ui-extensions/gjuchault/featcooldownbutton-add-a-startcooldown-t-1542805885685 (pull request #37)

feat(cooldown-button): add a `StartCooldown` to start cooldown from outside
pull/413/head
Gabriel Juchault 2018-11-26 12:23:58 +00:00 committed by Simon Jackson
commit ec836f9e87
1 changed files with 12 additions and 0 deletions

View File

@ -139,6 +139,18 @@ namespace UnityEngine.UI.Extensions
} }
} }
/// <summary>
/// Start a cooldown from outside
/// </summary>
public void StartCooldown()
{
PointerEventData emptySource = new PointerEventData(EventSystem.current);
buttonSource = emptySource;
OnCooldownStart.Invoke(emptySource.button);
cooldownTimeRemaining = cooldownTimeout;
CooldownActive = cooldownInEffect = true;
}
/// <summary> /// <summary>
/// Stop a running Cooldown and reset all values /// Stop a running Cooldown and reset all values
/// </summary> /// </summary>