Ejemplo n.º 1
0
    public void StartCooldown(string stateName)
    {
        AbilityCooldown value;

        if (abilityCooldowns.TryGetValue(stateName, out value))
        {
            CooldownCompleteCallbackDelegate callback = new CooldownCompleteCallbackDelegate(CooldownComplete);
            IEnumerator callbackTimer = CallbackTimer(callback, abilityCooldowns[stateName].duration, stateName);
            StartCoroutine(callbackTimer);
            callbackTimers.Add(callbackTimer);
            abilityCooldowns[stateName].onCooldown = true;
        }
        if (stateName == "DashState")
        {
            sr.color = Color.gray;
        }
    }
Ejemplo n.º 2
0
    IEnumerator CallbackTimer(CooldownCompleteCallbackDelegate callback, float duration, string stateName)
    {
        yield return(new WaitForSeconds(duration));

        callback(stateName);
    }