您的位置:首页 > 其它

AnimatorStateInfo 状态机信息 动画激活 动画结束

2015-09-25 12:15 375 查看

动画状态机怎么判断动画是否播完了?

AnimatorStateInfo.normalizedTime
  float normalizedTime;

  Description:

  Normalized time of the State.
  The integer part is the number of time a state has been looped. The fractional part is the % (0-1) of progress in the current loop.
  2. 代码如下:
  private Animator animator;

  void Start()

  {

       animator = this.GetComponent<Animator>();

  }

  void Update()

  {

      AnimatorStateInfo  info = animator.GetCurrentAnimatorStateInfo(0);

    // 判断动画是否播放完成

      if( info.normalizedTime >= 1.0f)

      {

          DoSomething();

      }

  }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: