Exemplo n.º 1
0
    /// <summary>
    /// 生成怪物
    /// </summary>
    /// <param name="brickRoots">所有砖块列表</param>
    /// <param name="monsters">怪物ID列表</param>
    /// <returns></returns>
    private static List <BrickRoot> GenBrickMonster(List <BrickRoot> brickRoots, List <int> monsters)
    {
        //对砖块进行随机排序
        List <BrickRoot> bricks = COMMON.RandomSortList(brickRoots);
        int brickNum            = brickRoots.Count;

        for (int i = 0; i < bricks.Count; i++)
        {
            if (COMMON.RandomIsSuccess(monsters.Count, brickNum))
            {
                bricks[i].GenMonster(monsters[0]);
                monsters.RemoveAt(0);
                bricks.RemoveAt(i);
            }
            brickNum -= 1;
            if (monsters.Count == 0)
            {
                break;
            }
        }
        return(bricks);
    }