-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tent.cs
46 lines (35 loc) · 1.04 KB
/
Tent.cs
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 System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Tent : Interactive {
public string[] lines;
public string objName;
public Sprite sprite;
public AudioSource ChimeSFX;
void OnTriggerEnter (Collider col){
if (col.name == "Hero") {
//Debug.Log ("You have entered the interactive range.");
Interact ();
}
}
void OnTriggerStay (Collider col){
if (col.name == "Hero" && Input.GetKeyDown (KeyCode.R) && !CharacterMovement.isDead && !CharacterMovement.isResting){
ChimeSFX.Play ();
CharacterMovement.SetRest (true);
}
}
void OnTriggerExit (Collider col){
if (col.name == "Hero") {
//Debug.Log ("You have left the interactive range.");
NotInteract ();
}
}
//If player is within interaction range, then start a dialogue
public override void Interact(){
DialogueManager.Instance.AddNewDialogue(lines, objName, sprite);
}
//If player leaves the interaction range, then disable the dialogue
public override void NotInteract(){
DialogueManager.Instance.CloseDialogue ();
}
}