Пример #1
0
    private void CheckGuess(char letter)
    {
        Boolean correct = false;

        for (int i = 0; i < word.Length; i++)
        {
            if (word[i] == letter)
            {
                //Modify Clue
                clueLetters.Insert(i, letter.ToString());
                clueLetters.RemoveAt(i + 1);
                correct = true;
            }
        }
        if (!correct)
        {
            CustomGameEventSystem.BroadcastChangeLives(-1);
        }
        //check for win
        if (!clueLetters.Contains("_"))
        {
            CustomGameEventSystem.BroadcastGameFinished(true);
        }

        PrintClue();
    }
Пример #2
0
    public void changeLives(int n)
    {
        if (lives != 0)
        {
            lives += n;
        }
        livesText.text = "Lives: " + lives;

        if (lives == 0)
        {
            CustomGameEventSystem.BroadcastGameFinished(false);
            GameFinished(false);
        }
    }