예제 #1
0
    private IEnumerator SetButtons(QuizHolder choices)
    {
        //Vira as opções no lado certo
        if (DialogueReader.Instance.GetIsPlayerForQuiz())
        {
            _npcAnimator.Play("npcAvatar_exit");
            yield return(new WaitForSeconds(0.5f));

            _npcAnimator.gameObject.SetActive(false);

            _buttonScale.localScale = new Vector3(1.0f, 1.0f, 1.0f);
            for (int i = 0; i < _scrollRectsScale.Length; i++)
            {
                _scrollRectsScale[i].localScale = new Vector3(1.0f, 1.0f, 1.0f);
            }
        }
        else
        {
            _playerAnimator.Play("playerAvatar_exit");
            yield return(new WaitForSeconds(0.5f));

            _playerAnimator.gameObject.SetActive(false);

            _buttonScale.localScale = new Vector3(-1.0f, 1.0f, 1.0f);
            for (int i = 0; i < _scrollRectsScale.Length; i++)
            {
                _scrollRectsScale[i].localScale = new Vector3(-1.0f, 1.0f, 1.0f);
            }
        }

        //Aguarda animação do título entrando
        yield return(new WaitForSeconds(0.5f));

        _actions = new UnityEvent[choices.Choices.Length];

        for (int i = 0; i < choices.Choices.Length; i++)
        {
            //Inicia o botão
            _buttons[i].SetActive(true);
            //Atribui a função ao botão
            _actions[i] = choices.Choices[i].Actions;
            //Pega o texto do botão
            _buttonsText[i].text = choices.Choices[i].ChoiceText;

            yield return(new WaitForSeconds(0.3f));
        }
    }
예제 #2
0
 public void FillData(QuizHolder choices)
 {
     StartCoroutine(SetButtons(choices));
 }