我们创建了 Fontainebleau 演示来说明摄影photogrammetry流程和 LayeredLit 着色器的使用。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

49 行
1.2 KiB

using System;
using UnityEngine;
using UnityEngine.Playables;
[RequireComponent(typeof(PlayableDirector))]
public class DirectorController : MonoBehaviour
{
[SerializeField]
float m_MaxSpeed;
[SerializeField]
float m_MinSpeed;
[SerializeField]
float m_SpeedDelta;
PlayableDirector m_Director;
float m_Speed;
void OnEnable()
{
m_Director = GetComponent<PlayableDirector>();
m_Speed = Mathf.Clamp(1, m_MinSpeed, m_MaxSpeed);
m_Director.RebuildGraph();
m_Director.playableGraph.GetRootPlayable(0).SetSpeed(m_Speed);
}
void Update()
{
if (Input.GetKeyDown(KeyCode.R))
{
m_Director.time = 0;
m_Director.Play();
return;
}
var delta = 0;
if (Input.GetKey(KeyCode.DownArrow))
delta = -1;
else if (Input.GetKey(KeyCode.UpArrow))
delta = 1;
else return;
m_Speed = Mathf.Clamp(m_Speed + delta * m_SpeedDelta, m_MinSpeed, m_MaxSpeed);
if(!m_Director.playableGraph.IsValid())
m_Director.RebuildGraph();
m_Director.playableGraph.GetRootPlayable(0).SetSpeed(m_Speed);
}
}