您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
37 行
940 B
37 行
940 B
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
|
|
namespace Cinemachine.Examples
|
|
{
|
|
|
|
public class GenericTrigger : MonoBehaviour
|
|
{
|
|
public PlayableDirector timeline;
|
|
|
|
// Use this for initialization
|
|
void Start()
|
|
{
|
|
timeline = GetComponent<PlayableDirector>();
|
|
}
|
|
|
|
void OnTriggerExit(Collider c)
|
|
{
|
|
if (c.gameObject.CompareTag("Player"))
|
|
{
|
|
// Jump to the end of the timeline where the blend happens
|
|
// This value (in seconds) needs to be adjusted as needed if the timeline is modified
|
|
timeline.time = 27;
|
|
}
|
|
}
|
|
|
|
void OnTriggerEnter(Collider c)
|
|
{
|
|
if (c.gameObject.CompareTag("Player"))
|
|
{
|
|
timeline.Stop(); // Make sure the timeline is stopped before starting it
|
|
timeline.Play();
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|