using UnityEngine;
using UnityEngine.Playables;
public class GenericTrigger : MonoBehaviour
{
public PlayableDirector timeline;
// Use this for initialization
void Start()
{
timeline = GetComponent<PlayableDirector>();
}
void OnTriggerExit(Collider c)
{
if (c.gameObject.tag == "Player")
{
timeline.Stop();
}
}
void OnTriggerEnter(Collider c)
{
if (c.gameObject.tag == "Player")
{
timeline.Play();
}
}
}
The idea is to create some kind of cut scene. Once the player (First person, in the screenshot i'm just showing the door on the left where the player will come from and the soldiers ) exit the door on the left and is in a specific distance from the soldier the first soldier the closet one will start moving to the player. Later I will make that it will change to close up view on the soldier with some text conversion. That's the main goal.
But the script the original script by the unity tutorial is using triggers. I'm not sure if I should using this way or using somehow by calculating the distance between the player and the soldier to start the timeline ? And how to do it.
After the soldier is moving/walking to the player at some point I will make it to change to a close up view on the soldier with blurry background something like this:
But first how should I approach to the triggering part ?