예제 #1
0
 private IEnumerator AttackRoutine()
 {
     while (enabled)
     {
         m_wizardBehaviour.Scream();
         yield return(new WaitForSeconds(DifficultyLevel * 2f));
     }
 }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (Application.isEditor && Input.GetKeyDown(KeyCode.Space))         // for debugging
        {
            m_wizardBehaviour.Scream();
            //m_wizardDeathBehaviour.enabled = true;
        }

        var pressed = m_keyCodes.Where(x => Input.GetKeyDown(x));

        if (!pressed.Any())
        {
            return;
        }
        //Debug.Log("Pressed: " + string.Join(" ", pressed.Select(x => x.ToString()).ToArray()));
        var words = GameObject.FindGameObjectsWithTag("Word").Select(x => x.GetComponent <TextHelper>());

        foreach (var word in words)
        {
            foreach (var a in pressed)
            {
                var ch = a.ToString().ToLower().ToCharArray().FirstOrDefault();
                if (word.GetNextCharacterToType() == ch)
                {
                    AudioSource.PlayClipAtPoint(CharacterEnteredSound, Vector3.zero);
                }
                else
                {
                    // TODO fail sound
                    continue;
                }
                if (word.AcceptCharacter(ch))
                {
                    m_wizardBehaviour.Scream();
                    AudioSource.PlayClipAtPoint(WordCompleteSound, Vector3.zero);
                }
            }
        }
    }