using System.Collections; using System.Collections.Generic; using UnityEngine; public class Play : MonoBehaviour { //int countIndex=1; public GameObject butPlay; Animator ani; AudioSource aud; public string playani; // Use this for initialization void Start () { ani = butPlay.GetComponent (); ani.speed = 0; aud = butPlay.GetComponent (); } // Update is called once per frame void Update () { if (Input.GetKeyDown(KeyCode.F)) { if(PauseSign.sign==false) { ani.speed = 1; ani.Play (playani, 0, 0f); } if (PauseSign.sign == true) { ani.speed = 1; PauseSign.sign = false; } } } public void onClick(){ //countIndex *= -1; //if(countIndex>0){ // ani.speed = 1; //} //if(countIndex<0){ // ani.speed = 0; //} if(PauseSign.sign==false) { ani.speed = 1; ani.Play (playani, 0, 0f); aud.Play (); } if (PauseSign.sign == true) { ani.speed = 1; PauseSign.sign = false; aud.Pause (); } } }