From 115f77bda0246a00f6e17469685c67746bdbd29d Mon Sep 17 00:00:00 2001 From: nirav Date: Sat, 12 Dec 2020 07:18:36 +0000 Subject: Initial commit --- Assets/Scripts/NPCScript.cs | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 Assets/Scripts/NPCScript.cs (limited to 'Assets/Scripts/NPCScript.cs') diff --git a/Assets/Scripts/NPCScript.cs b/Assets/Scripts/NPCScript.cs new file mode 100755 index 0000000..75db273 --- /dev/null +++ b/Assets/Scripts/NPCScript.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using System.Collections; +using UnityEngine.UI; + +public class NPCScript : MonoBehaviour { + + + DialogueScript dialogueScript; + public string dialogue; + public GameObject TipCanvas; + + void Start () + { + dialogueScript = GameObject.FindGameObjectWithTag("DialogueSystem").GetComponent(); + } + + void Update () + { + } + + + void OnTriggerStay2D(Collider2D col) + { + + + if (col.tag == "PlayerCollider" ) + { + // Show controller tooltip + TipCanvas.SetActive(true); + + // Show dialogue + if(Input.GetButtonDown("Action")) + dialogueScript.ShowMultiDialogue(dialogue); + + //"Did you see that big holes in the code line ?\n"+ + //"There must be something going on with th CPU.\n" + + //"You're a cursor, you can move around\n" + + //"Why don't you checkout what happened." + } + } + + private void OnTriggerExit2D(Collider2D collision) + { + TipCanvas.SetActive(false); + } +} -- cgit v1.2.3