Пример #1
0
    /// <summary>
    /// Check Player input
    /// </summary>
    void PressKey()
    {
        //get user input
        if (Input.anyKeyDown)
        {
            //Check if user input is equal with this gameobjects last letter

            //if user input is right
            if (Input.GetKeyDown(character))
            {
                //count up correct input
                letterEvent.correctInput++;

                //play sound when correct input
                if (letterEvent.gatherSound != null)
                {
                    Instantiate(letterEvent.gatherSound, player.position, Quaternion.identity);
                }

                Destroy(this.gameObject);
            }

            //if user input is wrong
            else
            {
                //QuickTimeEvent failed
                letterEvent.Fail();
                Destroy(this.gameObject);
            }
        }
    }