// enter key event void TryPick() { // if failed dont move if (Chances <= 0) { return; } // get cursored column script var temp = ColumnArray[CursorPosition].GetComponent <ColumnScript>(); var condition = temp.TextArray[1].text == temp.keychar && temp.TextArray[1].color == Color.red; // if pick success, goto next column if (condition) { temp.SetHacked(); if (CursorPosition >= EasyColCount - 1) { // Hacking succeed print("succeed"); // play sound effect SManager.HackingSucceed.Play(); StopTimer(); // show close popup HackedPanel.SetActive(true); GameObject.FindGameObjectWithTag("TimeUsedText").GetComponent <Text>().text = TScript.GetTimeUsed().ToString(); } else { // goto next column and play sound effect NextColumn(); SManager.KeyCorrect.Play(); } } else { // decrement chances and update ui Chances--; ChancesText.text = Chances.ToString(); // failed to hack if no chance if (Chances <= 0) { HackingFailed(); } else { // if failed goback to the previous column if (CursorPosition > 0) { PrevColumn(); } // play sound effect SManager.KeyError.Play(); } } }