Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class CrossAnimate : MonoBehaviour {
  7.  
  8.     public GameObject UpCurs;
  9.     public GameObject DownCurs;
  10.     public GameObject LeftCurs;
  11.     public GameObject RightCurs;
  12.  
  13.     // Use this for initialization
  14.     void Start () {
  15.        
  16.     }
  17.    
  18.     // Update is called once per frame
  19.     void Update () {
  20.         if (Input.GetMouseButtonDown(0))
  21.         {
  22.             UpCurs.GetComponent<Animator>().enabled = true;
  23.             DownCurs.GetComponent<Animator>().enabled = true;
  24.             LeftCurs.GetComponent<Animator>().enabled = true;
  25.             RightCurs.GetComponent<Animator>().enabled = true;
  26.             WaitingAnim();
  27.         }
  28.     }
  29.  
  30.     IEnumerator WaitingAnim()
  31.     {
  32.         yield return new WaitForSeconds(1f);
  33.  
  34.         UpCurs.GetComponent<Animator>().enabled = false;
  35.         DownCurs.GetComponent<Animator>().enabled = false;
  36.         LeftCurs.GetComponent<Animator>().enabled = false;
  37.         RightCurs.GetComponent<Animator>().enabled = false;
  38.     }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement