Beispiel #1
0
        public virtual void Repaint(IStat stat)
        {
            currentStat = stat;
            if (statName != null)
            {
                statName.text  = currentStat.definition.statName;
                statName.color = currentStat.definition.color;

                statName.gameObject.SetActive(true);
            }

            if (statValue.textField != null)
            {
                statValue.textField.color = currentStat.definition.color;
            }


            if (showLevels)
            {
                statValue.Repaint(currentStat.currentLevelIndex + 1, currentStat.definition.levels.Length);
            }
            else
            {
                statValue.Repaint(currentStat.currentValue, currentStat.currentMaxValue);
            }

            if (string.IsNullOrEmpty(statValue.textFormat) && statValue.textField != null)
            {
                statValue.textField.text = stat.ToString();
            }

            if (statIcon != null)
            {
                statIcon.sprite = currentStat.definition.icon;
                statIcon.color  = currentStat.definition.color;
                statIcon.gameObject.SetActive(true);

                if (currentStat.definition.icon == null)
                {
                    statIcon.gameObject.SetActive(false);
                }
                else
                {
                    if (hideStatNameIfIconIsPresent && statName != null)
                    {
                        statName.gameObject.SetActive(false);
                    }
                }
            }
        }
Beispiel #2
0
 public bool Equals(IStat other) => Equals(ToString(), other?.ToString());