PrevClick.cs 468 B

123456789101112131415161718
  1. using UnityEngine;
  2. namespace Asset_Cleaner {
  3. public struct PrevClick {
  4. const float DoubleClickTime = 0.5f;
  5. Object _target;
  6. float _timeClicked;
  7. public PrevClick(Object target) {
  8. _target = target;
  9. _timeClicked = Time.realtimeSinceStartup;
  10. }
  11. public bool IsDoubleClick(Object o) {
  12. return _target == o && Time.realtimeSinceStartup - _timeClicked < DoubleClickTime;
  13. }
  14. }
  15. }