Exemplo n.º 1
0
    private void Update()
    {
        PlayerControllerBase controller = PlayerControllerBase.GetActiveInstance();

        SpellBase[] spells = controller.Spells;

        for (int i = 0; i < spells.Length; i++)
        {
            cooldowns[i].text = controller.IsInCooldown(spells[i]) ? controller.GetCooldown(spells[i]).ToString("F1") : "";

            Color col = AVAILABLE;

            if (!spells[i].CompareLevelRequirement(controller))
            {
                col = UNAVAILABLE;
            }
            else if (!spells[i].VerifyCanCastSpell(controller, true))
            {
                col = UNUSABLE;
            }
            else
            {
                col = AVAILABLE;
            }

            renderers[i].color = Color.Lerp(renderers[i].color, col, Time.deltaTime * animationSpeed);

            if (controller.IsInCooldown(spells[i]))
            {
                cooldownOverlays[i].SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0F, BOX_SIZE.y * controller.GetCooldown(spells[i]) / spells[i].cooldown);
            }
        }
    }