Exemplo n.º 1
0
    public void Absorb(int id)
    {
        List <MonsterInfo> absorbList = new List <MonsterInfo>();

        for (int i = 0; i < allMonsters.Count; i++)
        {
            for (int j = 0; j < allMonsters[i].Count; j++)
            {
                MonsterInfo monsterInfo = allMonsters[i][j];

                if (monsterInfo.CanAbsorb(id))
                {
                    absorbList.Add(monsterInfo);
                }
            }
        }

        if (absorbList.Count > 0)
        {
            if (absorbIndex >= absorbList.Count)
            {
                absorbIndex = 0;
            }
            MonsterInfo monsterCheck = absorbList[absorbIndex];
            monsterCheck.Absorb(id);
            absorbIndex++;
        }
    }