Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5.  
  6. public class UnityChanController : MonoBehaviour
  7. {
  8. private Animator anim;
  9. private AnimatorStateInfo info;
  10.  
  11. void Start()
  12. {
  13. anim = GetComponent<Animator>();
  14. info = anim.GetCurrentAnimatorStateInfo(0);
  15. }
  16.  
  17. public void OnClick()
  18. {
  19. Debug.Log("Touch");
  20. anim.SetBool("Next", true);
  21. StartCoroutine(StartMotion());
  22. anim.SetBool("Next", false);
  23. }
  24. IEnumerator StartMotion()
  25. {
  26. anim.Update(0);
  27. info = anim.GetCurrentAnimatorStateInfo(0);
  28. Debug.Log(info.length);
  29. yield return new WaitForSeconds(info.length);
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement