예제 #1
0
    //Private IEnumerator helper for Exp: Helps kessens the workload per frame
    private IEnumerator expHelper(int deadEnemyLvl, PKMNEntity lastHitFighter)
    {
        //Goes through the entire party: 1 party member per frame
        for (int i = 0; i < numPartners; i++)
        {
            PKMNEntity curFighter = transform.GetChild(i).GetComponent <PKMNEntity>();
            float      curBaseExp = (curFighter == lastHitFighter) ? MAIN_BASE_EXP : SIDE_BASE_EXP;
            curFighter.gainExp(curBaseExp, deadEnemyLvl);
            abilityUIMap[curFighter].updateExp();
            yield return(new WaitForEndOfFrame());
        }

        //Accounts for assist fighters
        if (assistFighter != null)
        {
            yield return(new WaitForEndOfFrame());

            if (assistFighter == lastHitFighter)
            {
                assistFighter.gainExp(MAIN_BASE_EXP, deadEnemyLvl);
            }
            else
            {
                assistFighter.gainExp(SIDE_BASE_EXP, deadEnemyLvl);
            }

            abilityUIMap[assistFighter].updateExp();
        }
    }