Advertisement
GabrielRabeloLopes

TwoTap

Dec 4th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4.  
  5. public abstract class TwoTap: MonoBehaviour {
  6. Touch[] phases;
  7. public int amountTouches = 0;
  8. public float timerTouch;
  9.  
  10. void Update ()
  11. {
  12. phases = Input.touches;
  13. timerTouch += Time.deltaTime;
  14. if (phases.Length > 0 && phases[0].phase == TouchPhase.Ended)
  15. {
  16. amountTouches++;
  17. if (amountTouches == 1)
  18. timerTouch = 0;
  19. if (amountTouches > 1 && timerTouch > 1)
  20. amountTouches = 0;
  21. if (amountTouches == 2 && timerTouch <= 1)
  22. {
  23. //AƇƃO QUE VAI ACONTECER QUANDO DER DOIS TOQUES//
  24. amountTouches = 0;
  25. }
  26. }
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement