示例#1
0
 private void OnRecipeStart(Recipe recipe)
 {
     brian.inQte = true;
     Debug.Log("Starting a new recipe !");
     _currentRecipe = recipe;
     _currentRecipe.Begin();
     _waitedInput = recipe.GetNextStroke();
     qtePannel.transform.localScale = new Vector3(1, 1, 1);
     Debug.Log("Waited input is " + _waitedInput.Key);
 }
示例#2
0
    // Update is called once per frame
    private void Update()
    {
        if (_currentRecipe != null)
        {
            _waitingForQteInput = true;
        }

        if (_waitingForQteInput)
        {
            if (_currentRecipe == null)
            {
                throw new ArgumentNullException();
            }

            if (Input.anyKeyDown && !PlayerIsTryingToMove())
            {
                if (Input.GetButtonDown(_waitedInput.TechnicalKeyName))
                {
                    Debug.Log("Right Input stroked ! Asking recipe for the next input");
                    GameEvents.Instance.GoodInputPressed();
                }
                else
                {
                    Debug.Log("Missed, score decreased and QTE skipped !");
                    _currentRecipe.DecreaseScore();
                    GameEvents.Instance.WrongInputPressed();
                }

                _waitedInput = _currentRecipe.GetNextStroke();
                Debug.Log("New wanted input is " + (_waitedInput?.Key ?? "<none>"));

                if (_waitedInput == null)
                {
                    brian.inQte = false;
                    DisplayRecipeFeedback();

                    Debug.Log("End of the QTE ! The score is : " + _currentRecipe.CurrentScore);
                    GameEvents.Instance.RecipeFinished(_currentRecipe);
                    _waitingForQteInput            = false;
                    _currentRecipe                 = null;
                    qtePannel.transform.localScale = new Vector3(0, 0, 0);
                }
            }
        }
    }