예제 #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
파일: Lives.cs 프로젝트: KhodiG/2450Hangman
    public void changeLives(int n)
    {
        if (lives != 0)
        {
            lives += n;
        }
        livesText.text = "Lives: " + lives;

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