Beispiel #1
0
    IEnumerator Battlecry()
    {
        GetComponent <AnimController>().Cast();
        Log.SpawnLog(myUnit.name + " uses Battlecry, increasing nearby allies' attack and removing all negative effects.");


        foreach (UnitScript ally in Helper.GetAlliesInRange(myUnit, Range))
        {
            StartCoroutine(PassiveAbility_Buff_BattlecryBuff.AddMyBuff(myUnit, ally, VFXOnBuffedAllies, RingOfBuff, 1.5f));
        }

        yield return(null);

        FinishUsing();
    }
Beispiel #2
0
    public static IEnumerator AddMyBuff(UnitScript me, UnitScript ally, GameObject vfxTemporary, GameObject vfxPermanent, float timeDelay)
    {
        PassiveAbility_Buff_BattlecryBuff theBuff = ally.gameObject.AddComponent <PassiveAbility_Buff_BattlecryBuff>();

        theBuff.HasIcon                   = true;
        theBuff.AbilityIconName           = "BattlecryBuff";
        theBuff.AttackBuffValue           = 1;
        theBuff.DefenceBuffValue          = 0;
        theBuff.MovementBuffValue         = 0;
        theBuff.QuitCombatChanceBuffValue = 0;
        theBuff.BuffDuration              = 2;
        theBuff.IsFrozen                  = false;
        theBuff.isNegative                = false;
        theBuff.watchForAttacksBy         = me;
        theBuff.DoBuff();

        foreach (PassiveAbility_Buff buff in ally.gameObject.GetComponents <PassiveAbility_Buff>())
        {
            if (buff.isNegative)
            {
                buff.UndoBuff();
            }
        }

        if (vfxTemporary != null)
        {
            theBuff.vfx = Instantiate(vfxTemporary, ally.gameObject.transform.position, vfxTemporary.transform.rotation, ally.gameObject.transform);
        }

        yield return(new WaitForSeconds(timeDelay));

        if (vfxPermanent != null)
        {
            theBuff.vfx = Instantiate(vfxPermanent, ally.gameObject.transform.position, vfxPermanent.transform.rotation, ally.gameObject.transform);
        }
    }