コード例 #1
0
    //消除一个
    public void PopOne(int id)
    {
        int scoreMul = _game.scoreMul;

        if (_game.scoreMul > 1)
        {
            _game.SetScoreMul(1);
        }
        _starsPosition.DoPopOne(id);
        int         x, y;
        Star        star;
        List <Star> popStars  = new List <Star>();
        List <Star> moveStars = new List <Star>();

        x    = id >> 4;
        y    = 9 - (id & 0xf);
        star = _stars[x][y].GetComponent <Star>();
        popStars.Add(star);//添加到要删除星星列表进行逐个删除
        _stars[x].RemoveAt(y);

        for (int j = y; j < _stars[x].Count; j++)
        {
            star = _stars[x][j].GetComponent <Star>();
            star.AddMoveDown(_offset);
            star.isStopMove = true;//设true禁止Update移动,等待逐个删除完成
            moveStars.Add(star);
        }
        //测试左移
        CheckMoveLeft(moveStars);
        DeleteOneByOne(popStars, moveStars, true, scoreMul);
        //若盘面达到终结,计算奖励分值,结束当前
        CheckGameOver();
    }