Play.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class Play : MonoBehaviour {
  5. //int countIndex=1;
  6. public GameObject butPlay;
  7. Animator ani;
  8. AudioSource aud;
  9. public string playani;
  10. // Use this for initialization
  11. void Start () {
  12. ani = butPlay.GetComponent<Animator> ();
  13. ani.speed = 0;
  14. aud = butPlay.GetComponent<AudioSource> ();
  15. }
  16. // Update is called once per frame
  17. void Update () {
  18. if (Input.GetKeyDown(KeyCode.F)) {
  19. if(PauseSign.sign==false)
  20. {
  21. ani.speed = 1;
  22. ani.Play (playani, 0, 0f);
  23. }
  24. if (PauseSign.sign == true)
  25. {
  26. ani.speed = 1;
  27. PauseSign.sign = false;
  28. }
  29. }
  30. }
  31. public void onClick(){
  32. //countIndex *= -1;
  33. //if(countIndex>0){
  34. // ani.speed = 1;
  35. //}
  36. //if(countIndex<0){
  37. // ani.speed = 0;
  38. //}
  39. if(PauseSign.sign==false)
  40. {
  41. ani.speed = 1;
  42. ani.Play (playani, 0, 0f);
  43. aud.Play ();
  44. }
  45. if (PauseSign.sign == true)
  46. {
  47. ani.speed = 1;
  48. PauseSign.sign = false;
  49. aud.Pause ();
  50. }
  51. }
  52. }