Beispiel #1
0
    // user submits row
    public void Submit()
    {
        // lock buttons
        Lock();

        submitButton.gameObject.SetActive(false);
        // get row colors
        MastermindColor[] guess = buttons.Select(button => button.mastermindColor).ToArray();
        // submit
        MastermindResult result = mastermind.Test(guess);

        // TODO: do something at end of game
        if (!mastermind.Success() && !mastermind.Failure())
        {
            displayResults.GetComponent <DisplayResults>().switchDisplays(result);
            //Debug.Log($"Red: {result.red}, White: {result.white}");
            // create next row
            mastermind.AddRow();
        }
        else
        {
            displayResults.GetComponent <DisplayResults>().switchDisplays(result);
        }
    }