Exemple #1
0
    public void DestroyRandom()
    {
        dropFruit();
        if (PlayerInfo.MODE == 1)
        {
            if (!IsStar)
            {
                List <CellObj> listeff = getListCellEffect();

                if (listeff.Count > 0)
                {
                    CellObj tmp = listeff[Random.Range(0, listeff.Count)];
                    tmp.RemoveEffect();
                    EffectSpawner.effect.Thunder(GridManager.grid.GridCell[(int)tmp.Cell.CellPosition.x, (int)tmp.Cell.CellPosition.y].transform.position);
                }
                else
                {
                    destroyNotEmpty();
                }
            }
            else
            {
                Vector2  vtmp = posUnderStar();
                FruitObj tmp  = FruitSpawner.spawn.FruitGridScript[(int)vtmp.x, (int)vtmp.y];
                if (tmp != null && tmp != FruitStar)
                {
                    tmp.Destroy();
                    EffectSpawner.effect.Thunder(GridManager.grid.GridCell[(int)tmp.Fruit.FruitPosition.x, (int)tmp.Fruit.FruitPosition.y].transform.position);
                }
            }
        }
    }
Exemple #2
0
    public void DestroyRandom()
    {
        //uu tien destroy ganh
        dropjewel();
        if (PLayerInfo.MODE == 1)
        {
            if (!isStar)
            {
                List <CellObj> listeff = getListCellEffect();

                if (listeff.Count > 0)
                {
                    CellObj tmp = listeff[Random.Range(0, listeff.Count)];
                    tmp.RemoveEffect();
                    EffectSpawner.effect.Thunder(GribManager.cell.GribCell[(int)tmp.cell.CellPosition.x, (int)tmp.cell.CellPosition.y].transform.position);
                }
                else
                {
                    destroynotempty();
                }
            }
            else
            {
                Vector2  vtmp = posUnderStar();
                JewelObj tmp  = JewelSpawner.spawn.JewelGribScript[(int)vtmp.x, (int)vtmp.y];
                if (tmp != null && tmp != JewelStar)
                {
                    tmp.Destroy();
                    EffectSpawner.effect.Thunder(GribManager.cell.GribCell[(int)tmp.jewel.JewelPosition.x, (int)tmp.jewel.JewelPosition.y].transform.position);
                }
            }
        }
    }
 // 随机消除一个宝石
 public void DestroyRandom()
 {
     //uu tien destroy ganh
     dropjewel();// 开启下落检查
     // 如果是街机模式
     if (PLayerInfo.MODE == 1)
     {
         // 如果没有星星宝石
         if (!isStar)
         {
             // 获取有特效的格子列表
             List <CellObj> listeff = getListCellEffect();
             // 如果有这样的格子
             if (listeff.Count > 0)
             {
                 // 从列表中随机获取一个格子
                 CellObj tmp = listeff[Random.Range(0, listeff.Count)];
                 // 播放并移除特效
                 tmp.RemoveEffect();
                 // 播放火球特效
                 EffectSpawner.effect.Thunder(GribManager.cell.GribCell[(int)tmp.cell.CellPosition.x, (int)tmp.cell.CellPosition.y].transform.position);
             }
             else
             {
                 // 从特殊格子中随机一个消除
                 destroynotempty();
             }
         }
         else
         {
             // 星星下方随机一个图块坐标
             Vector2 vtmp = posUnderStar();
             // 根据坐标获取宝石对象
             JewelObj tmp = JewelSpawner.spawn.JewelGribScript[(int)vtmp.x, (int)vtmp.y];
             // 如果该宝石对象不为空且不是星星宝石
             if (tmp != null && tmp != JewelStar)
             {
                 // 销毁该对象
                 tmp.Destroy();
                 // 播放火球特效
                 EffectSpawner.effect.Thunder(GribManager.cell.GribCell[(int)tmp.jewel.JewelPosition.x, (int)tmp.jewel.JewelPosition.y].transform.position);
             }
         }
     }
 }