forked from TouchScript/TouchScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHitTest.cs
More file actions
64 lines (51 loc) · 1.69 KB
/
Copy pathHitTest.cs
File metadata and controls
64 lines (51 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* @author Valentin Simonov / http://va.lent.in/
*/
using UnityEngine;
namespace TouchScript.Hit
{
/// <summary>
/// Base class for all hit test handlers.
/// </summary>
public abstract class HitTest : MonoBehaviour
{
#region Constants
/// <summary>
/// Result of a check to find if a hit object should recieve this touch or not.
/// </summary>
public enum ObjectHitResult
{
/// <summary>
/// Something happened.
/// </summary>
Error = 0,
/// <summary>
/// This is a hit, object should recieve touch.
/// </summary>
Hit = 1,
/// <summary>
/// Object should not recieve touch.
/// </summary>
Miss = 2,
/// <summary>
/// Object should not recieve touch and this touch should be discarded and not tested with any other object.
/// </summary>
Discard = 3
}
#endregion
#region Public methods
/// <summary>
/// Determines whether a touch point hit the object.
/// </summary>
/// <param name="hit">Data from a raycast.</param>
/// <returns><see cref="ObjectHitResult.Hit"/> if touch point hits the object, <see cref="ObjectHitResult.Miss"/> if it doesn't, <see cref="ObjectHitResult.Discard"/> if it doesn't and this touch must be ignored, Error otherwise.</returns>
public virtual ObjectHitResult IsHit(ITouchHit hit)
{
return ObjectHitResult.Hit;
}
#endregion
#region Unity methods
private void OnEnable() {}
#endregion
}
}