public void AddRandomStat(Stat stat, int amount)
    {
        randomStat = new Stat();
        switch (GameManager.language)
        {
        case Language.English:
            statAmountTxt.text = string.Format("{0} Stats", amount);
            break;

        case Language.Korean:
            statAmountTxt.text = string.Format("{0} 개", amount);
            break;
        }

        while (stat.sumMax != stat.sumOrigin)
        {
            if (amount <= 0)
            {
                break;
            }
            STAT type = (STAT)Random.Range(0, (int)STAT.MR + 1);
            if (stat.AddOrigin(type, 1))
            {
                randomStat.AddOrigin(type, 1, false, true);
                amount--;
            }
        }
        for (int i = 0; i < (int)STAT.MR + 1; i++)
        {
            statTxts[i].text = string.Format("{0} {1}", ((STAT)i).ToString(), randomStat.GetOrigin(i));
        }
    }
Exemplo n.º 2
0
    private void RandomStat(Stat stat)
    {
        int statPoint = stat.statPoints;

        Debug.Log("RandomStat " + stat.statPoints);
        while (statPoint > 0)
        {
            int type = Random.Range(0, (int)STAT.MR + 1);
            if (stat.AddOrigin((STAT)type, 1))
            {
                //Debug.Log(((STAT)type).ToString());
                statPoint--;
            }
            else
            {
                int origin = (int)stat.sumOrigin;
                int max    = (int)stat.sumMax;
                Debug.Log(string.Format("origin:{0},max:{1}", origin, max));
                if (origin >= max)
                {
                    break;
                }
            }
        }
    }