//밖에서도 부를스 있게... public void colorTouch(string key) { ColorSeq++; //이 변수는 순서에 상관없이 색타일을 터치했다면 무조건 증가 ColorTouchList.Add(key); //순서에 상관없이 색타일 터치 리스트에 추가 //그게 순서에 맞는 색타일이었으면 if (checkColorSeq()) { this.rightAudio.Play(); m_SeqTilesDictionary[ColorSeq].touched = true; m_SeqTilesDictionary[ColorSeq].touchTime = Time.deltaTime; } else { //순서틀렸으면 메세지 guideText.addMessage("순서가 틀렸다찌!"); this.errorAudio.Play(); } }
//믹스타일의 위치 파악 // void findMixKey() // { // board.colorPos[]; // } //색 칠할수 있는지 체크 함수 bool touchAble(Vector3 pos, GameObject touchedObject) { if (board.getStartOrNot()) { string start = board.getStart(); int x = int.Parse(start.Substring(0, 1)); int y = int.Parse(start.Substring(2, 1)); if (pos.x == x && pos.y == y) { guideText.deleteMessage("첫 터치는 시작점부터다찌!"); return(true); } else { guideText.addMessage("첫 터치는 시작점부터다찌!"); return(false); } } //초기상태가 아닐경우 else { string key = pos.x.ToString() + "," + pos.y.ToString(); //한번 터치한 타일을 중복터치 불가능 if (board.getChecked(key)) { return(false); } else if (board.getJump(key) && board.touchJumpCount(key) == 0) //점프타일 위치이고, 점프속성을 가지고 있는 상태이면 { if (miniTouchAble(pos, touchedObject)) { Lastpos = pos; //라스트포지션을 해당위치로 갱신 jumpTile = false; //이제 더이상 점프타일 속성을 갖지 않음... } return(false); } // else if (board.getMix(key) && board.touchJumpCount(key) == 0) { if (miniTouchAble(pos, touchedObject)) { Lastpos = pos; //위치갱신 board.colorTouch(key); board.putTileInTouchList(key); GameObject child = board.m_TilesDictionary[key].transform.GetChild(1).gameObject; render = child.GetComponent <SpriteRenderer>(); Color color; ColorUtility.TryParseHtmlString("#A6A6A6", out color); render.color = color; } return(false); } else { //가장 마지막으로 터치한 타일의 위, 아래, 옆만 터치 가능. if ((Lastpos.x == pos.x - 1) && (Lastpos.y == pos.y)) { return(true); } else if ((Lastpos.x == pos.x + 1) && (Lastpos.y == pos.y)) { return(true); } else if ((Lastpos.x == pos.x) && (Lastpos.y == pos.y - 1)) { return(true); } else if ((Lastpos.x == pos.x) && (Lastpos.y == pos.y + 1)) { return(true); } else { //믹스타일에서 똑같은거 연속터치했을때 경고 안뜨게 if문 if (board.touchJumpCount(key) == 0) { guideText.addMessage("터치가 이어져야 한다찌!"); } return(false); } } } }