private void InitLogic() { for (var i = 0; i < 3; i++) { this.buttons[i] = new LogicalButton(i, Constants.ButtonColors[rnd.Range(0, 9)], Constants.WordStrings[rnd.Range(0, 9)]); } //// Debuging purposes //this.buttons[0] = new LogicalButton(0, ButtonColor.Orange, Constants.ColorString); //this.buttons[1] = new LogicalButton(1, ButtonColor.Grey, Constants.LogicString); //this.buttons[2] = new LogicalButton(2, ButtonColor.Grey, Constants.LogicString); //this.gateOperator = LogicalGateOperatorFactory.Create(Constants.XorOperatorString); //this.stage = 3; this.pressCount = 0; this.gateOperator = LogicalGateOperatorFactory.Create(Constants.GateStrings[rnd.Range(0, 6)]); this.helper = new LogicalButtonsHelper(this.buttons, this.gateOperator); this.solution = this.helper.SolveOrder(this.stage); OperatorTxt.text = this.gateOperator.Name; Btn1Text.text = buttons[0].Label; Btn2Text.text = buttons[1].Label; Btn3Text.text = buttons[2].Label; Btn1Renderer.sharedMaterial = materials[Constants.ButtonColors.IndexOf(buttons[0].Color)]; Btn2Renderer.sharedMaterial = materials[Constants.ButtonColors.IndexOf(buttons[1].Color)]; Btn3Renderer.sharedMaterial = materials[Constants.ButtonColors.IndexOf(buttons[2].Color)]; Debug.LogFormat("[Logical Buttons #{0}] STAGE: {1}", this._moduleId, this.stage); this.DebugMessage(); ColorBlindIndicatorTop.text = buttons[0].Color.ToString(); ColorBlindIndicatorLeft.text = buttons[1].Color.ToString(); ColorBlindIndicatorRight.text = buttons[2].Color.ToString(); }
private static ILogicalGateOperator ChangeLogicalGateOperator(ILogicalGateOperator currentOperator) { var newOperator = LogicalGateOperatorFactory.Create(Constants.GateStrings[rnd.Range(0, 6)]); while (currentOperator.Name == newOperator.Name) { newOperator = LogicalGateOperatorFactory.Create(Constants.GateStrings[rnd.Range(0, 6)]); } return(newOperator); }