revival/game/Assets/Scripts/Dialogue/ScriptedDialogueTrigger.cs

27 lines
629 B
C#
Raw Normal View History

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;
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}");
}
_dialogue.PlayLine(_key);
}
}