TouchEvent.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using bbiwarg.Detectors.Fingers;
  7. using bbiwarg.Utility;
  8. namespace bbiwarg.Detectors.Touch
  9. {
  10. class TouchEvent
  11. {
  12. private Vector2D _position;
  13. public Vector2D Position { get { return _position; } private set { _position = value; } }
  14. private float _floodValue;
  15. public float FloodValue { get { return _floodValue; } private set { _floodValue = value; } }
  16. private Finger _finger;
  17. public Finger Finger { get { return _finger; } private set { _finger = value; } }
  18. public TouchEvent(Vector2D position, float floodValue, Finger finger) {
  19. Position = position;
  20. FloodValue = floodValue;
  21. Finger = finger;
  22. }
  23. public bool isSimilarTo(TouchEvent compareTouchEvent) {
  24. float maxDistance = 20;
  25. float distance = Position.getDistanceTo(compareTouchEvent.Position);
  26. return (distance < maxDistance);
  27. }
  28. }
  29. }