コード例 #1
0
 public void UpdateUI(Ability ability)
 {
     if (HexGridController.ActiveCharacter.playerControlled)
     {
         if (ability.cost - 1 < HexGridController.ActiveCharacter.characterData.Energy.CurrentValue)
         {
             enabledHoverImage.UpdateUI(
                 $"{ability.abilityName}\n" +
                 $"{ability.abilityDescription} \n\n" +
                 $"<color=#00ff00> Ready </color> \n" +
                 $"{ability.cost} Energy",
                 ability.AbilitySprite);
             abilityImage.sprite = ability.AbilitySprite;
             Enabled(true);
         }
         else
         {
             enabledHoverImage.UpdateUI(
                 $"{ability.abilityName}\n" +
                 $"{ability.abilityDescription} \n\n" +
                 $"<color=red> Not enough energy </color> \n" +
                 $"{ability.cost} Energy",
                 ability.AbilitySprite);
             abilityCost.text = ability.cost.ToString();
             Enabled(false);
         }
     }
 }
コード例 #2
0
    private void NewLog(Character character)
    {
        string          text;
        MouseHoverImage logBox = Instantiate(prefab, transform);

        if (combatLog.Count > combatLogLimit)
        {
            DestroyImmediate(combatLog.Dequeue().gameObject);
        }
        combatLog.Enqueue(logBox);
        if (character.logMessage.Message == "")
        {
            text = "Did nothing this turn.";
        }
        else
        {
            text = character.logMessage.Message;
        }
        logBox.UpdateUI(text, character.portrait);
    }