Example #1
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;
            }
        }