public void FinishPiece(PieceControl piece) { piece.GetComponent <Renderer>().material.renderQueue = GetDrawPriorityFinishedPiece(); activePieces.Remove(piece); pieceFinishedNum++; SetHeightOffsetToPieces(); }
/// <summary> /// 完成拼图 /// </summary> /// <param name="piece"></param> public void FinishPiece(PieceControl piece) { int i, j; piece.GetComponent <Renderer>().material.renderQueue = this.GetDrawPriorityFinishedPiece(); //将被点击的碎片从数组中剔除 for (i = 0; i < this.active_pieces.Length; i++) { if (this.active_pieces[i] == null) { continue; } if (this.active_pieces[i].name == piece.name) { //将位于被点击的碎片之后的碎片逐个往前移动 for (j = i; j < this.active_pieces.Length - 1; j++) { //直接把j后一位的数值赋值到j的位置,以此类推直到最后一位 this.active_pieces[j] = this.active_pieces[j + 1]; } //清空数组的末尾 this.active_pieces[this.active_pieces.Length - 1] = null; //得到正解的碎片数量+1 this.piece_finished_num++; break; } } this.Set_Height_Offset_To_Pieces(); }
// 碎片被放置到正解位置时的处理 public void FinishPiece(PieceControl piece) { int i, j; piece.GetComponent <Renderer>().material.renderQueue = this.GetDrawPriorityFinishedPiece(); for (i = 0; i < this.active_pieces.Length; i++) { if (this.active_pieces[i] == null) { continue; } if (this.active_pieces[i].name == piece.name) { for (j = i; j < this.active_pieces.Length - 1; j++) { this.active_pieces[j] = this.active_pieces[j + 1]; } this.active_pieces[this.active_pieces.Length - 1] = null; this.piece_finished_num++; break; } } }
// 碎片被放置到正解位置时的处理 public void FinishPiece(PieceControl piece) { int i, j; piece.GetComponent <Renderer>().material.renderQueue = this.GetDrawPriorityFinishedPiece(); // 将被点击的碎片从数组中剔除 for (i = 0; i < this.active_pieces.Length; i++) { if (this.active_pieces[i] == null) { continue; } if (this.active_pieces[i].name == piece.name) { // 将位于“被点击碎片”之后的碎片逐个往前移动 // for (j = i; j < this.active_pieces.Length - 1; j++) { this.active_pieces[j] = this.active_pieces[j + 1]; } // 清空数组的末尾 this.active_pieces[this.active_pieces.Length - 1] = null; // “已经得到正解的碎片”的数量 + 1 this.piece_finished_num++; break; } } this.set_height_offset_to_pieces(); }
// ピースが正解の位置におかれたときの処理. public void FinishPiece(PieceControl piece) { int i, j; piece.GetComponent <Renderer>().material.renderQueue = this.GetDrawPriorityFinishedPiece(); // クリックされたピースを配列から取り除く for (i = 0; i < this.active_pieces.Length; i++) { if (this.active_pieces[i] == null) { continue; } if (this.active_pieces[i].name == piece.name) { // 『クリックされたピース』より後ろにあるピースを、いっこづつ前にずらす. // for (j = i; j < this.active_pieces.Length - 1; j++) { this.active_pieces[j] = this.active_pieces[j + 1]; } // 配列の末尾を空にする. this.active_pieces[this.active_pieces.Length - 1] = null; // 『正解済みのピース』の数を+1する. this.piece_finished_num++; break; } } this.set_height_offset_to_pieces(); }