2021-03-02 14:24:18 +01: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 01:57:07 +02:00
|
|
|
|
|
|
|
[SerializeField] private bool _log;
|
2021-03-02 14:24:18 +01:00
|
|
|
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
|
|
{
|
2021-05-12 21:10:58 +02:00
|
|
|
if ( !other.CompareTag( "Player" ) )
|
|
|
|
return;
|
|
|
|
|
2021-04-27 01:57:07 +02:00
|
|
|
if (_log)
|
|
|
|
{
|
|
|
|
Debug.Log($"{other} triggered dialogue {_key}");
|
|
|
|
}
|
|
|
|
|
2021-03-02 14:24:18 +01:00
|
|
|
_dialogue.PlayLine(_key);
|
|
|
|
}
|
|
|
|
}
|