Beispiel #1
0
    public void SearchLetter(char searchingChar)
    {
        Debug.Log("searching char is : " + searchingChar);
        bool GuessFinded = true;
        bool charfinded  = false;

        for (int i = 0; i < nameTryingGuess.Length; i++)
        {
            if (nameTryingGuess[i] == searchingChar)
            {
                guessingString[i] = searchingChar;
                charfinded        = true;
            }
            if (guessingString[i] == '_')
            {
                GuessFinded = false;
            }
        }

        if (charfinded)
        {
            //call gussed succes func.
            if (!GuessFinded)
            {
                FindObjectOfType <AudioManager>().Play("pressKey");
            }
            GuessTextMesh.text = guessingString.ToString();
        }
        else
        {
            PLAYER.WrongGuess();
        }

        if (GuessFinded)
        {
            PLAYER.SuccesfulGuees();
            FindObjectOfType <InputKeyboard>().LockMyKeyboard();
            succesfulGuess = true;
        }

        Debug.Log("guessingString : " + guessingString);
        Debug.Log("nameTryingGuess : " + nameTryingGuess);
    }