forked from TouchScript/TouchScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTouchHitFactory.cs
More file actions
50 lines (43 loc) · 1.25 KB
/
Copy pathTouchHitFactory.cs
File metadata and controls
50 lines (43 loc) · 1.25 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
/*
* @author Valentin Simonov / http://va.lent.in/
*/
using UnityEngine;
namespace TouchScript.Hit
{
/// <summary>
/// A factory which is used to create instances of ITouchHit.
/// </summary>
public sealed class TouchHitFactory : ITouchHitFactory
{
/// <summary>
/// A static instance of a TouchHitFactory which is used to create instances of ITouchHit.
/// </summary>
public static ITouchHitFactory Instance
{
get { return instance ?? (instance = new TouchHitFactory()); }
}
private static TouchHitFactory instance;
private TouchHitFactory() {}
/// <inheritdoc />
public ITouchHit GetTouchHit(RaycastHit value)
{
var result = new TouchHit3D();
result.InitWith(value);
return result;
}
/// <inheritdoc />
public ITouchHit GetTouchHit(RaycastHit2D value)
{
var result = new TouchHit2D();
result.InitWith(value);
return result;
}
/// <inheritdoc />
public ITouchHit GetTouchHit(Transform value)
{
var result = new TouchHit();
result.InitWith(value);
return result;
}
}
}