// 매칭을 확인후 봄을 만들어주는 함수 public void CheckBombs() { // 플레이어가 블록을 움직였다면 if (board.currentDot != null) { // "사용자가 움직인 블럭"으로 봄을 만들 수 있는 매칭이 성립된다면 if (board.currentDot.isMatched) { // 그 위치에 봄을 만들것이므로 매칭되지 않은 상태로 바꿔주고 board.currentDot.isMatched = false; // 생성할 봄을 정함 // 오른쪽, 왼쪽으로 스와이프 했을 경우 if ((board.currentDot.swipeAngle > -45 && board.currentDot.swipeAngle <= 45) || (board.currentDot.swipeAngle < -135 || board.currentDot.swipeAngle >= 135)) { board.currentDot.MakeRowBomb(); board.currentDot.ChangeColorToOriginalColor(); } // 오른쪽, 왼쪽 스와이프가 아닌경우(세로) else { board.currentDot.MakeColumnBomb(); board.currentDot.ChangeColorToOriginalColor(); } // 생성할 봄을 정함(반반 확률 랜덤생성) /* int typeOfBomb = Random.Range(0, 100); * if(typeOfBomb < 50) * { * // 가로봄 생성 * board.currentDot.MakeRowBomb(); * board.currentDot.ChangeColorToOriginalColor(); * } * else if(typeOfBomb >= 50) * { * // 세로봄 생성 * board.currentDot.MakeColumnBomb(); * board.currentDot.ChangeColorToOriginalColor(); * * }*/ } // 사용자가 움직이지 않은 블록으로부터 봄을 만들 수 있는 매칭이 성립될경우 else if (board.currentDot.otherDot != null) { Dot otherDot = board.currentDot.otherDot.GetComponent <Dot>(); // 매칭이 성립되면 if (otherDot.isMatched) { // 아래의 원래는 위와 비슷 otherDot.isMatched = false; // 오른쪽, 왼쪽으로 스와이프 했을 경우 if ((board.currentDot.swipeAngle > -45 && board.currentDot.swipeAngle <= 45) || (board.currentDot.swipeAngle < -135 || board.currentDot.swipeAngle >= 135)) { otherDot.MakeRowBomb(); otherDot.ChangeColorToOriginalColor(); } // 오른쪽, 왼쪽 스와이프가 아닌경우(세로) else { otherDot.MakeColumnBomb(); otherDot.ChangeColorToOriginalColor(); } // 생성할 봄을 정함 /* int typeOfBomb = Random.Range(0, 100); * if (typeOfBomb < 50) * { * // 가로봄 생성 * otherDot.MakeRowBomb(); * otherDot.ChangeColorToOriginalColor(); * } * else if (typeOfBomb >= 50) * { * // 세로봄 생성 * otherDot.MakeColumnBomb(); * otherDot.ChangeColorToOriginalColor(); * * } */ } } } }