Advertisement
LittleAngel

Stale GUITexture Button

May 31st, 2012
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1.  
  2. using UnityEngine;
  3. using System.Collections;
  4.  
  5. [RequireComponent (typeof (GUITexture))]
  6.  
  7. public class TouchButton : MonoBehaviour {
  8. public GUITexture theButton;
  9. public ButtonType buttonType;
  10. public float tapTime;
  11. private int tapCount;
  12. private float tapTimer;
  13.  
  14. void Awake () {
  15. tapCount = 0;
  16. tapTimer = 0.0f;
  17. }
  18.  
  19. void Update () {
  20. if (tapTimer > 0) tapTimer -= Time.deltaTime;
  21. else tapCount = 0;
  22.  
  23. if (Input.touchCount > 0) {
  24. foreach (Touch touch in Input.touches) {
  25. if (theButton.HitTest(touch.position)) {
  26.  
  27. // DoSomething();
  28.  
  29. }
  30. }
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement