blob: 75db273e9982fb372b4361b2b2105ca2504c9403 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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);
}
}
|