public void OnButtonSelect(SelectableButton _button) { if (SolutionState != PuzzleState.Unsolved) { return; } // Labled Button; foreach (var button in LabledButtons) { if (button == _button) { buttonHits++; TurbineButtonData data = button.InputData as TurbineButtonData; SetEValues(data.E1Modifier, data.E2Modifier, data.E3Modifier, data.E4Modifier); } } // Reset Button if (_button == resetButton) { CheckIfSolved(); } if (SolutionState == PuzzleState.Unsolved) { selectable.Select(); } }
bool IsSolvable(PuzzleCombination _combination, TurbineButtonData newButton) { int[] currentEs = _combination.InitialEValues; currentEs[0] -= newButton.E1Modifier; if (currentEs[0] < 0 || currentEs[0] > 100) { return(false); } currentEs[1] -= newButton.E2Modifier; if (currentEs[1] < 0 || currentEs[1] > 100) { return(false); } currentEs[2] -= newButton.E3Modifier; if (currentEs[2] < 0 || currentEs[2] > 100) { return(false); } currentEs[3] -= newButton.E4Modifier; if (currentEs[3] < 0 || currentEs[3] > 100) { return(false); } return(true); }