jretchy

Untitled

May 16th, 2021
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1.  
  2.     public Animator anim;
  3.  
  4.     private void Start()
  5.     {
  6.         anim.enabled = true;
  7.     }
  8.  
  9.     private void Update()
  10.     {
  11.         if (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow))
  12.         {
  13.             StartCoroutine(PlayAnim());
  14.         }
  15.  
  16.         if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D))
  17.         {
  18.             StartCoroutine(PlayAnim());
  19.         }
  20.     }
  21.  
  22.  
  23.     IEnumerator PlayAnim()
  24.     {
  25.         yield return new WaitForSeconds(3);
  26.         anim.SetBool("HitKey", true);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment