示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (ability != null)
     { //TODO probably move for performance
         tooltipAbility.SetAbility(ability);
     }
 }
 public void SetAbility(Ability ability, bool isSelected)
 {
     currentAbility = ability;
     if (ability == null)
     {
         icon.sprite       = null;
         icon.color        = ColorPallete.GetColor("Grey");
         highlight.enabled = false;
     }
     else
     {
         icon.sprite = SpriteLibrary.GetAbilitySprite(ability.abilityName);
         icon.color  = Color.white;
         tooltip.SetAbility(ability);
         tooltip.gameObject.SetActive(false);
         selected = isSelected;
         if (selected)
         {
             highlight.enabled = true;
         }
         else
         {
             highlight.enabled = false;
         }
     }
 }
示例#3
0
 public void OnHoverEnter(BaseEventData baseEventData)
 {
     if (ability != null && ability.TooltipPrefab != null)
     {
         tooltip = Instantiate <AbilityTooltip>(ability.TooltipPrefab, transform);
         tooltip.SetAbility(ability);
     }
 }
示例#4
0
    // Update is called once per frame
    void Update()        //TODO make this only trigger when the ability is changed
    {
        if (!player)
        {
            return;
        }

        AbilityList abilityList = player.GetComponent <AbilityList>();

        if (abilityList.abilities.Count < abilityNumber)
        {
            return;
        }

        if (ability != abilityList.abilities[abilityNumber - 1])
        {
            // update the ability
            ability = abilityList.abilities[abilityNumber - 1];
            // update the tooltip
            tooltipAbility.SetAbility(abilityList.abilities[abilityNumber - 1]);
            // update the icon
            icon.sprite = abilityList.abilities[abilityNumber - 1].abilitySprite;
            // activate or deactivate the cooldown bar
            //activateCooldownBarIfNecessary();
            // update the number of charges in the charge display
            //chargeDisplay.updateMaxCharges((int) playerCharges.maxCharges[abilityNumber - 1]);
            // inform the skill saving manager
            save();
        }

        if (!playerMana.hasEnoughManaToUse(ability))
        {
            if (!outOfMana.gameObject.activeSelf)
            {
                outOfMana.gameObject.SetActive(true);
            }
        }
        else
        {
            outOfMana.gameObject.SetActive(false);
        }

        //if (cooldownBar.gameObject.activeSelf)
        //{
        //    cooldownBar.currentFill = 1 - playerCharges.getChargesFloat(ability);
        //    if (cooldownBar.currentFill < 0) { cooldownBar.currentFill = 0; }
        //}

        if (cooldownBarActive && cooldownBar && !cooldownBar.gameObject.activeSelf)
        {
            cooldownBar.gameObject.SetActive(true);
        }

        if (!cooldownBarActive && cooldownBar && cooldownBar.gameObject.activeSelf)
        {
            cooldownBar.gameObject.SetActive(false);
        }
    }
示例#5
0
 public void SetAbility(Ability a, Unit actor)
 {
     ability     = a;
     currentUnit = actor;
     tooltip.SetAbility(a);
     if (a == null)
     {
         pic.sprite = defaultEmpty;
         pic.color  = ColorPallete.GetColor("Black");
         usable     = false;
     }
     else
     {
         pic.sprite = SpriteLibrary.GetAbilitySprite(a.abilityName);
         SetUsable();
     }
 }
示例#6
0
    // Update is called once per frame
    void Update()
    {
        if (ability != null)           //TODO probably move for performance
        {
            tooltipAbility.SetAbility(ability);
        }

        if (skillTree == null)
        {
            foreach (SkillTree tree in SkillTree.all)
            {
                if (tree.ability == ability)
                {
                    skillTree = tree;
                }
            }
        }
    }