public void Exchange(Gemstone c1, Gemstone c2) //寶石交換位置 { GetComponent <AudioSource>().PlayOneShot(swapClip); SetGemstone(c1.rowIndex, c1.columnIndex, c2); SetGemstone(c2.rowIndex, c2.columnIndex, c1); //交换c1,c2的行 int tempRowIndex; tempRowIndex = c1.rowIndex; c1.rowIndex = c2.rowIndex; c2.rowIndex = tempRowIndex; //交换c1,c2的列 int tempColumnIndex; tempColumnIndex = c1.columnIndex; c1.columnIndex = c2.columnIndex; c2.columnIndex = tempColumnIndex; //c1.UpdatePosition (c1.rowIndex, c1.columnIndex); //c2.UpdatePosition (c2.rowIndex, c2.columnIndex); c1.TweenToPostion(c1.rowIndex, c1.columnIndex); c2.TweenToPostion(c2.rowIndex, c2.columnIndex); Debug.Log("交換寶石位置囉~"); }
void RemoveGemstone(Gemstone c) //删除宝石 { c.Dispose(); GetComponent <AudioSource>().PlayOneShot(match3Clip); for (int i = c.rowIndex + 1; i < rowNum; i++) { Gemstone temGemstone = GetGemstone(i, c.columnIndex); temGemstone.rowIndex--; SetGemstone(temGemstone.rowIndex, temGemstone.columnIndex, temGemstone); temGemstone.TweenToPostion(temGemstone.rowIndex, temGemstone.columnIndex); } Gemstone newGemstone = AddGemstone(rowNum, c.columnIndex); newGemstone.rowIndex--; SetGemstone(newGemstone.rowIndex, newGemstone.columnIndex, newGemstone); newGemstone.TweenToPostion(newGemstone.rowIndex, newGemstone.columnIndex); UpdateScore(10); }
void RemoveGemstone(Gemstone c) { //删除宝石 c.Dispose(); audio.PlayOneShot(match3Clip); for (int i = c.rowIndex + 1; i < rowNum; i++) { Gemstone temGemstone = GetGemstone(i, c.columnIndex); temGemstone.rowIndex--; SetGemstone(temGemstone.rowIndex, temGemstone.columnIndex, temGemstone); temGemstone.TweenToPostion(temGemstone.rowIndex, temGemstone.columnIndex); } Gemstone newGemstone = AddGemstone(rowNum, c.columnIndex); newGemstone.rowIndex--; SetGemstone(newGemstone.rowIndex, newGemstone.columnIndex, newGemstone); newGemstone.TweenToPostion(newGemstone.rowIndex, newGemstone.columnIndex); }
void RemoveGemstone(Gemstone c) //消除寶石 { Debug.Log("消除寶石!"); c.Dispose(); GetComponent <AudioSource>().PlayOneShot(match3Clip); for (int i = c.rowIndex + 1; i < rowNum; i++) { Gemstone temGemstone = GetGemstone(i, c.columnIndex); temGemstone.rowIndex--; SetGemstone(temGemstone.rowIndex, temGemstone.columnIndex, temGemstone); //temGemstone.UpdatePosition (temGemstone.rowIndex,temGemstone.columnIndex); temGemstone.TweenToPostion(temGemstone.rowIndex, temGemstone.columnIndex); } Gemstone newGemstone = AddGemstone(rowNum, c.columnIndex); newGemstone.rowIndex--; SetGemstone(newGemstone.rowIndex, newGemstone.columnIndex, newGemstone); //newGemstone.UpdatePosition (newGemstone.rowIndex, newGemstone.columnIndex); newGemstone.TweenToPostion(newGemstone.rowIndex, newGemstone.columnIndex); }
public void Exchange(Gemstone c1, Gemstone c2) { //实现宝石之间交换位置 audio.PlayOneShot(swapClip); SetGemstone(c1.rowIndex, c1.columnIndex, c2); SetGemstone(c2.rowIndex, c2.columnIndex, c1); //交换c1,c2的行号 int tempRowIndex; tempRowIndex = c1.rowIndex; c1.rowIndex = c2.rowIndex; c2.rowIndex = tempRowIndex; //交换c1,c2的列号 int tempColumnIndex; tempColumnIndex = c1.columnIndex; c1.columnIndex = c2.columnIndex; c2.columnIndex = tempColumnIndex; c1.TweenToPostion(c1.rowIndex, c1.columnIndex); c2.TweenToPostion(c2.rowIndex, c2.columnIndex); }