-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGrab.cs
118 lines (115 loc) · 4.62 KB
/
Grab.cs
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// GENERATED AUTOMATICALLY FROM 'Assets/Controls.inputactions'
using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Experimental.Input;
namespace Grab
{
[Serializable]
public class Grab : InputActionAssetReference
{
public Grab()
{
}
public Grab(InputActionAsset asset)
: base(asset)
{
}
private bool m_Initialized;
private void Initialize()
{
// Main
m_Main = asset.GetActionMap("Main");
m_Main_VRGrabL = m_Main.GetAction("VRGrabL");
if (m_MainVRGrabLActionStarted != null)
m_Main_VRGrabL.started += m_MainVRGrabLActionStarted.Invoke;
if (m_MainVRGrabLActionPerformed != null)
m_Main_VRGrabL.performed += m_MainVRGrabLActionPerformed.Invoke;
if (m_MainVRGrabLActionCancelled != null)
m_Main_VRGrabL.cancelled += m_MainVRGrabLActionCancelled.Invoke;
m_Initialized = true;
}
private void Uninitialize()
{
if (m_MainActionsCallbackInterface != null)
{
Main.SetCallbacks(null);
}
m_Main = null;
m_Main_VRGrabL = null;
if (m_MainVRGrabLActionStarted != null)
m_Main_VRGrabL.started -= m_MainVRGrabLActionStarted.Invoke;
if (m_MainVRGrabLActionPerformed != null)
m_Main_VRGrabL.performed -= m_MainVRGrabLActionPerformed.Invoke;
if (m_MainVRGrabLActionCancelled != null)
m_Main_VRGrabL.cancelled -= m_MainVRGrabLActionCancelled.Invoke;
m_Initialized = false;
}
public void SetAsset(InputActionAsset newAsset)
{
if (newAsset == asset) return;
var MainCallbacks = m_MainActionsCallbackInterface;
if (m_Initialized) Uninitialize();
asset = newAsset;
Main.SetCallbacks(MainCallbacks);
}
public override void MakePrivateCopyOfActions()
{
SetAsset(ScriptableObject.Instantiate(asset));
}
// Main
private InputActionMap m_Main;
private IMainActions m_MainActionsCallbackInterface;
private InputAction m_Main_VRGrabL;
[SerializeField] private ActionEvent m_MainVRGrabLActionStarted;
[SerializeField] private ActionEvent m_MainVRGrabLActionPerformed;
[SerializeField] private ActionEvent m_MainVRGrabLActionCancelled;
public struct MainActions
{
private Grab m_Wrapper;
public MainActions(Grab wrapper) { m_Wrapper = wrapper; }
public InputAction @VRGrabL { get { return m_Wrapper.m_Main_VRGrabL; } }
public ActionEvent VRGrabLStarted { get { return m_Wrapper.m_MainVRGrabLActionStarted; } }
public ActionEvent VRGrabLPerformed { get { return m_Wrapper.m_MainVRGrabLActionPerformed; } }
public ActionEvent VRGrabLCancelled { get { return m_Wrapper.m_MainVRGrabLActionCancelled; } }
public InputActionMap Get() { return m_Wrapper.m_Main; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled { get { return Get().enabled; } }
public InputActionMap Clone() { return Get().Clone(); }
public static implicit operator InputActionMap(MainActions set) { return set.Get(); }
public void SetCallbacks(IMainActions instance)
{
if (m_Wrapper.m_MainActionsCallbackInterface != null)
{
VRGrabL.started -= m_Wrapper.m_MainActionsCallbackInterface.OnVRGrabL;
VRGrabL.performed -= m_Wrapper.m_MainActionsCallbackInterface.OnVRGrabL;
VRGrabL.cancelled -= m_Wrapper.m_MainActionsCallbackInterface.OnVRGrabL;
}
m_Wrapper.m_MainActionsCallbackInterface = instance;
if (instance != null)
{
VRGrabL.started += instance.OnVRGrabL;
VRGrabL.performed += instance.OnVRGrabL;
VRGrabL.cancelled += instance.OnVRGrabL;
}
}
}
public MainActions @Main
{
get
{
if (!m_Initialized) Initialize();
return new MainActions(this);
}
}
[Serializable]
public class ActionEvent : UnityEvent<InputAction.CallbackContext>
{
}
}
public interface IMainActions
{
void OnVRGrabL(InputAction.CallbackContext context);
}
}