示例#1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         dialogue.ShowDialogue();
         anim.enabled = true;
     }
 }
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         if (Input.GetKey(KeyCode.E))
         {
             dialogue.ShowDialogue();
         }
     }
 }
 public void npcTalk()
 {
     if (canTalk)
     {
         Scene currentScene = SceneManager.GetActiveScene();
         if (Input.GetKey(KeyCode.E))
         {
             if (this.gameObject.tag == "Dern")
             {
                 SceneManager.LoadScene("Dern");
             }
             if (this.gameObject.tag == "Jasper")
             {
                 SceneManager.LoadScene("Jasper");
                 player.GetComponent <PlayerMovement>().startPoint = "afterjasper";
             }
             if (this.gameObject.tag == "Gerard")
             {
                 SceneManager.LoadScene("Gerard");
                 player.GetComponent <PlayerMovement>().startPoint = "RouteA to 1";
             }
             if (this.gameObject.tag == "Rik")
             {
                 SceneManager.LoadScene("Rik");
                 player.GetComponent <PlayerMovement>().startPoint = "Route3 afterbattle";
             }
             else
             {
                 if (currentScene.name != "Jasper")
                 {
                     dialogue.ShowDialogue();
                 }
             }
         }
     }
 }