So I decided to use a timeline and animation clips to make automated cinematics. It plays perfectly fine upon hitting the entry trigger, but when hitting the exit trigger it just restarts the timeline rather than stopping it entirely.
Here is the cinematic trigger script:
public class CinematicTrigger : MonoBehaviour {
public PlayableDirector director;
public PlayableAsset timeline;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
director.playableAsset = timeline;
if (director.state != PlayState.Playing)
{
director.Play();
}
else if (director.state == PlayState.Playing)
{
director.Stop();
}
}
}
}