public void SpawnNewPair() { if (pairs.Any()) { fallingPair = pairs.First(); fallingPair.Puyo1.transform.position = new Vector3(-2f, 7f); fallingPair.Puyo2.transform.position = new Vector3(-2f, 8f); pairs.Remove(pairs.First()); } }
private void FixPair() { // todo correct puyo position and add to array and add column and row properties // Round Pos var p1pos = fallingPair.Puyo1.transform.position; var roundedP1PosY = (float)Math.Round(p1pos.y); fallingPair.Puyo1.transform.position = new Vector3(p1pos.x, roundedP1PosY); var p2pos = fallingPair.Puyo2.transform.position; var roundedP2PosY = (float)Math.Round(p2pos.y); fallingPair.Puyo2.transform.position = new Vector3(p2pos.x, roundedP2PosY); // Find Column and Row var p1col = getColumnFromXPosition(fallingPair.Puyo1.transform.position.x); var p1row = getRowFromYPosition(fallingPair.Puyo1.transform.position.y); var p2col = getColumnFromXPosition(fallingPair.Puyo2.transform.position.x); var p2row = getRowFromYPosition(fallingPair.Puyo2.transform.position.y); //Debug.Log(string.Format("p1 col : {0}, p1 row : {1}\np2col : {2}, p2row : {3}", p1col, p1row, p2col, p2row)); // Update array puyos[p1row, p1col] = fallingPair.Puyo1; puyos[p1row, p1col].GetComponent <Puyo>().Column = p1col; puyos[p1row, p1col].GetComponent <Puyo>().Row = p1row; puyos[p2row, p2col] = fallingPair.Puyo2; puyos[p2row, p2col].GetComponent <Puyo>().Column = p2col; puyos[p2row, p2col].GetComponent <Puyo>().Row = p2row; // ResetFallingPair fallingPair = null; }