美文网首页
Unity Timeline动画播放和暂停

Unity Timeline动画播放和暂停

作者: 114105lijia | 来源:发表于2022-04-19 09:41 被阅读0次
    using UnityEngine.Playables;
    
    public class MyJoystick : MonoBehaviour
    {
         PlayableDirector director;
    
         void Start()
         {
              director = this.transform.GetComponent<PlayableDirector>();
         }
    
         private void FixedUpdate()
         {
              float horizontal = variableJoystick.Horizontal;
              float vertical = variableJoystick.Vertical;
    
             //走路动画
               if (horizontal == 0 && vertical == 0)
               {
                   director.Pause();
               }
               else
               {
                   director.Play();
               }
         }
    }
    

    相关文章

      网友评论

          本文标题:Unity Timeline动画播放和暂停

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