Exemplo n.º 1
0
    private void Update()
    {
        trollSprite.flipX = transform.position.x > playerTrans.position.x;

        if (Input.GetKeyDown(KeyCode.Space) && buttonPrompt.activeSelf && !dialogueManager.isOpen)
        {
            buttonPrompt.SetActive(false);

            switch (dialogueState)
            {
            case DialogueState.Initial:
                dialogueManager.StartDialogue(initialDialogue);
                dialogueState = DialogueState.Middle;
                coinReqUI.SetActive(true);
                coinReqUI.transform.Find("Image").GetComponent <Image>().color = reqCoinColor;
                TMP_Text text = coinReqUI.transform.Find("Text").GetComponent <TMP_Text>();
                text.color = reqCoinColor;
                text.text  = reqCoinAmount.ToString();
                break;

            case DialogueState.Middle:
                if (coinManager.hasCoins(reqCoinColor, reqCoinAmount))
                {
                    coinManager.payCoins(reqCoinColor, reqCoinAmount);
                    dialogueManager.StartDialogue(reqMetDialogue);
                    dialogueState = DialogueState.End;
                    coinReqUI.SetActive(false);
                    musicController.AddTrack();
                    StartCoroutine(BastionizeBridge());
                }
                else
                {
                    dialogueManager.StartDialogue(reqNotMetDialogue);
                }
                break;

            case DialogueState.End:
                dialogueManager.StartDialogue(doneDialogue);
                break;
            }
        }
    }