Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Animator anim;
- private void Start()
- {
- anim.enabled = true;
- }
- private void Update()
- {
- if (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow))
- {
- StartCoroutine(PlayAnim());
- }
- if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D))
- {
- StartCoroutine(PlayAnim());
- }
- }
- IEnumerator PlayAnim()
- {
- yield return new WaitForSeconds(3);
- anim.SetBool("HitKey", true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment