Esempio n. 1
0
    public IEnumerator UseAbility(AllyAbility ability, Unit target)
    {
        // start animation
        anim.SetTrigger("onAbility(" + ability.GetTitle() + ")");
        abilityAnimState = 1;

        // changing [abilityAnimState] back to 0 ends the ability
        while (abilityAnimState > 0)
        {
            // let ability do its thang
            var targetableAbility = ability as TargetableAllyAbility;
            if (targetableAbility != null)
            {
                targetableAbility.OnAnimStateActivate(this, target, abilityAnimState);
            }
            else
            {
                ability.OnAnimStateActivate(this, abilityAnimState);
            }

            var currAnimState = abilityAnimState;

            // wait for anim state to change
            yield return(new WaitUntil(() => abilityAnimState != currAnimState));
        }
    }
Esempio n. 2
0
    public void SetAbility(AllyAbility ability)
    {
        this.ability = ability;

        titleObj.text       = ability.GetTitle();
        descriptionObj.text = ability.GetDescription();
        manaCostObj.text    = "x" + ability.GetCost();

        var targetableAbility = ability as TargetableAllyAbility;

        if (targetableAbility != null)
        {
            rangeObj.text = "Range: " + targetableAbility.GetRange();
        }
        else
        {
            rangeObj.text = "";
        }
    }