예제 #1
0
 /// <summary>
 /// checks if this QTE is in view of the camera, if so the QTE will be set to active.
 /// </summary>
 private void CheckIfInViewOfCamera()
 {
     if (spriteRenderer.isVisible)
     {
         state = QuickTimeEventState.Active;
     }
 }
예제 #2
0
    /// <summary>
    /// Checks for any key that is pressed. And compares it to the key that has to be pressed, if correct the player may continue, else it wont do anything.
    /// </summary>
    private void GetUserInput()
    {
        for (int i = 0; i < quickTimeEventKeys.Length; i++)
        {
            if (Input.anyKeyDown && keyToPressIndex < quickTimeEventKeys.Length)
            {
                if (Input.GetKeyDown(quickTimeEventKeys[keyToPressIndex].KeyToPress))
                {
                    Debug.Log("Pressed the CORRECT key!");

                    keyToPressIndex++;
                    if (keyToPressIndex == quickTimeEventKeys.Length)
                    {
                        state = QuickTimeEventState.Completed;
                        spriteRenderer.sprite = null;
                        return;
                    }
                    else
                    {
                        spriteRenderer.sprite = quickTimeEventKeys[keyToPressIndex].KeySprite;
                    }
                }
                else
                {
                    Debug.Log("Pressed the WRONG key!");
                }
            }
        }
    }