美文网首页
2019-12-03【Timeline|转自群友】Playabl

2019-12-03【Timeline|转自群友】Playabl

作者: 持刀的要迟到了 | 来源:发表于2019-12-03 22:12 被阅读0次
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.Playables;  // Timeline相關
     
    public class TimelineTool : MonoBehaviour{
        //放入帶有Playable Director的物件(Director用"Hold"模式)
        public PlayableDirector Director;
     
        void Update(){
            if (Input.GetKeyDown(KeyCode.A)){
                Director.Pause();           //先 Pause();
                StartCoroutine("tRewind"); //倒帶
            } 
        }
     
     
        //倒帶 ================================================================ 3
        public IEnumerator tRewind(){
            yield return new WaitForSeconds(0.001f * Time.deltaTime);
            Director.time -= 1.0f * Time.deltaTime;  //1.0f是倒帶速度
            Director.Evaluate();
            if (Director.time < 0f){
                Director.time = 0f;
                Director.Evaluate();
            }
            else {            
                StartCoroutine("tRewind");
            }
        }
    
    

    相关文章

      网友评论

          本文标题:2019-12-03【Timeline|转自群友】Playabl

          本文链接:https://www.haomeiwen.com/subject/fiwhgctx.html