Beispiel #1
0
 public static void AddCooldown(string name, int cooldown)
 {
     if (!configCooldownsEnabled.Value)
     {
         return;
     }
     activeCooldowns.Add(name, cooldown);
     SpellsBar.SetExtraTexts(name, cooldown);
 }
Beispiel #2
0
        private void Update()
        {
            if (tryAgain)
            {
                tryAgainTime += Time.deltaTime;
                if (tryAgainTime >= tryAgainDuration)
                {
                    tryAgain = false;
                    TryRegisterRecipes();
                }
            }

            if (Player.m_localPlayer?.TakeInput() == true)
            {
                SpellsBar.CheckInputs();
            }

            tickCooldown += Time.deltaTime;

            if (tickCooldown >= 1f)
            {
                tickCooldown -= 1f;

                var keys         = activeCooldowns.Keys;
                var newCooldowns = new Dictionary <string, int>();

                foreach (var key in keys)
                {
                    var cd = activeCooldowns[key] - 1;

                    if (cd > 0)
                    {
                        newCooldowns[key] = cd;
                        SpellsBar.SetExtraTexts(key, cd);
                    }
                    else
                    {
                        SpellsBar.SetExtraTexts(key, 0);
                    }
                }

                activeCooldowns = newCooldowns;
            }
        }