/// <summary> /// Swaps the two buttons selected. /// </summary> private void CheckSwap() { //reset bogosort easter egg progress _pushTimes = 0; //information dump, bogosort should not state this information due to potential spam with the amount of swaps you have to make if (!_bogoSort) { Debug.LogFormat("[Sorting #{0}] Swapping buttons {1} to {2}", _moduleId, _buttons[_selected[0]], _buttons[_selected[1]]); } //ensures that the highest number is the least significant digit if (_selected[0] < _selected[1]) { //lower number translates to most significant digit swapButtons = (byte)((_selected[0] + 1) * 10); swapButtons += (byte)(_selected[1] + 1); } else { //lower number translates to most significant digit swapButtons = (byte)((_selected[1] + 1) * 10); swapButtons += (byte)(_selected[0] + 1); } //checks if the swap is valid if (algorithms.IfValid(Screen.text, _initialButtons, swapButtons, swapIndex, _moduleId, Info.GetSerialNumberNumbers)) { DoSwap(); } else { Debug.LogFormat("[Sorting #{0}] Swap was invalid! Strike! The buttons have been reorganized back into their original state.", _moduleId); Audio.PlaySoundAtTransform(Sounds.Srt.Strike, Module.transform); Module.HandleStrike(); _doAction = false; background.GetComponent <MeshRenderer>().material.color = _strikeBackgroundColor; //resets the buttons for (int i = 0; i < btn.Length; i++) { btn[i].GetComponent <MeshRenderer>().material.color = _strikeColor; } //reset buttons so that they are ready to be pressed again ResetNumber(); Invoke("ResetButtons", 0.2f); } }