Esempio n. 1
0
    /// <summary>
    /// 单击选择一个格子,高亮可消除的所有格子,1秒后取消选中状态
    /// 双击一个格子,触发消除相连的同颜色格子
    /// </summary>
    /// <param name="cube"></param>
    void OnClickStar(GameObject cube)
    {
        if (starMap.selectedStar && starMap.selectedStar == cube)
        { //double click
            PreprocessPopStar();
            return;
        }
        if (starMap.selectedStar)
        {
            CancelSelectImmediately();
        }
        starMap.selectedStar = cube;
        starMap.SearchStarChunk();

        if (starMap.eliminableList.Count > 1)
        {
            predictPoint = (int)(5 * Mathf.Pow(starMap.eliminableList.Count, 2));
            UpdateText();
        }
        //Debug.Log("可消除星星个数:" + starMap.eliminableList.Count + ", 分数:" + predictPoint);
        starMap.LightEliminableStar();
        // Invoke("CancelSelect", 1);   // 处于性能的角度,不使用
        DOVirtual.DelayedCall(1, CancelSelect);
    }