示例#1
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.P))
        {
            SceneManager.LoadScene(levelToLoad, LoadSceneMode.Single);
        }
        if (canTalk && Input.GetKeyDown(KeyCode.Space))
        {
            playerController.playerState = overworldPlayerController.PlayerState.Talking;


            if (currentLine < myDialogue.Length - 1)
            {
                currentLine++;
                talkToMe.SetActive(false);

                if (!score.CheckIfLevelWon(myLevel)) //if the player has not won the level, have the monk tell them to start the level
                {
                    theText.text = myDialogue[currentLine];
                }
                else
                {
                    theText.text = myDialogueWon[currentLine];
                }
            }
            else
            {
                playerController.playerState = overworldPlayerController.PlayerState.Walking;
                currentLine = -1;
                dialogueBox.SetActive(false);
                canTalk = false;
            }

            canMeditate = true;
            dialogueBox.SetActive(true);
        }
        if (canTalk == false)
        {
            talkToMe.SetActive(false);
        }
        if (!score.CheckIfLevelWon(myLevel) && canMeditate && Input.GetKeyDown(KeyCode.X))
        {
            StartCoroutine(LoadNextScene());
        }
    }