29 lines
611 B
C#
29 lines
611 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
|
|
public class VoicelineTrigger : MonoBehaviour
|
|
{
|
|
[SerializeField] private PlayableDirector voicelinePlayable;
|
|
|
|
private bool _voicelinePlayed;
|
|
|
|
private void Awake()
|
|
{
|
|
if(voicelinePlayable == null)
|
|
{
|
|
voicelinePlayable = GetComponent<PlayableDirector>();
|
|
}
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider col)
|
|
{
|
|
if (!_voicelinePlayed)
|
|
{
|
|
voicelinePlayable.Play();
|
|
_voicelinePlayed = true;
|
|
}
|
|
}
|
|
}
|