| 
									
										
										
										
											2021-03-02 13:24:18 +00:00
										 |  |  | using System; | 
					
						
							|  |  |  | using System.Collections; | 
					
						
							|  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  | using UnityEngine; | 
					
						
							|  |  |  | using UnityEngine.Serialization; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public class ScriptedDialogueTrigger : MonoBehaviour | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     [SerializeField] private DialogueSystem _dialogue; | 
					
						
							|  |  |  |     [SerializeField] private string _key; | 
					
						
							| 
									
										
										
										
											2021-04-27 00:57:07 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     [SerializeField] private bool _log; | 
					
						
							| 
									
										
										
										
											2021-03-02 13:24:18 +00:00
										 |  |  |      | 
					
						
							|  |  |  |     private void OnTriggerEnter(Collider other) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2021-05-12 20:10:58 +01:00
										 |  |  |         if ( !other.CompareTag( "Player" ) ) | 
					
						
							|  |  |  |             return; | 
					
						
							|  |  |  |          | 
					
						
							| 
									
										
										
										
											2021-04-27 00:57:07 +01:00
										 |  |  |         if (_log) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             Debug.Log($"{other} triggered dialogue {_key}"); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |          | 
					
						
							| 
									
										
										
										
											2021-03-02 13:24:18 +00:00
										 |  |  |         _dialogue.PlayLine(_key); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |