diff options
Diffstat (limited to 'Assets/Scripts/NPCScript.cs')
-rwxr-xr-x | Assets/Scripts/NPCScript.cs | 46 |
1 files changed, 46 insertions, 0 deletions
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<DialogueScript>(); + } + + 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); + } +} |