Beispiel #1
0
 /// <summary>
 /// Method for changing the fill of the overlay image corresponding to the ability
 /// </summary>
 /// <param name="overlayImage">Image for visualizing cooldown</param>
 /// <param name="ability">The ability corresponding to the action bar slot</param>
 public void ActionBarUpdate(ref Image overlayImage, Ability ability)
 {
     if (ability.OnCooldown()) {
         if(ability.CooldownRemaining() < 0) {
             if (!castBar.gameObject.activeSelf) {
                 string[] subpar = ability.tooltipText.Split(':');
                 castBar.gameObject.SetActive(true);
                 Color color = subpar[0] == "Poison Dart" ? new Color(106f / 255f, 197f / 255f, 54f / 255f) : new Color(106f / 255f, 0f / 255f, 0f / 255f);
                 castBar.fillRect.GetComponentInChildren<Image>().color = color;
                 castBar.targetGraphic.GetComponentInChildren<Image>().color = new Color(255f / 255f, 255f / 255f, 255f / 255f);
                 currentText = string.Format("Out of {0} Berries", subpar[0] == "Poison Dart" ? "Bad" : "Good");
                 castBar.GetComponentInChildren<Text>().text = currentText;
                 castBar.value = 1;
             }
         }
         overlayImage.fillAmount = ability.CooldownRemaining();
     } else if (overlayImage.fillAmount < 1) {
         overlayImage.fillAmount = 1;
     }
 }