예제 #1
0
    // 宝石交换位置
    public void Exchange(GemStone c1, GemStone c2)
    {
        audioSource.PlayOneShot(swapClip);

        setGemStone(c1._row, c1._col, c2);
        setGemStone(c2._row, c2._col, c1);

        int tRow;

        tRow    = c1._row;
        c1._row = c2._row;
        c2._row = tRow;

        int tCol;

        tCol    = c1._col;
        c1._col = c2._col;
        c2._col = tCol;

        // 更新位置
        //c1.UpdatePosition(c1._row, c1._col);
        //c2.UpdatePosition(c2._row, c2._col);
        c1.TweenToPosition(c1._row, c1._col);
        c2.TweenToPosition(c2._row, c2._col);
    }
예제 #2
0
    public void RemoveGemStone(GemStone c)
    {
        Debug.Log("移除");
        c.Dispose();
        audioSource.PlayOneShot(matchClip);
        for (int r = c._row + 1; r < rowNum; r++)
        {
            GemStone t = GetGemStone(r, c._col);
            t._row--;
            setGemStone(t._row, t._col, t);
            //t.UpdatePosition(t._row, t._col);
            t.TweenToPosition(t._row, t._col);
        }

        GemStone newGemStone = AddGemStone(rowNum, c._col);

        newGemStone._row--;
        setGemStone(newGemStone._row, newGemStone._col, newGemStone);
        //newGemStone.UpdatePosition(newGemStone._row, newGemStone._col);
        newGemStone.TweenToPosition(newGemStone._row, newGemStone._col);
    }