Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- [RequireComponent (typeof (GUITexture))]
- public class TouchButton : MonoBehaviour {
- public GUITexture theButton;
- public ButtonType buttonType;
- public float tapTime;
- private int tapCount;
- private float tapTimer;
- void Awake () {
- tapCount = 0;
- tapTimer = 0.0f;
- }
- void Update () {
- if (tapTimer > 0) tapTimer -= Time.deltaTime;
- else tapCount = 0;
- if (Input.touchCount > 0) {
- foreach (Touch touch in Input.touches) {
- if (theButton.HitTest(touch.position)) {
- // DoSomething();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement