-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
Samples~/Asym-Apartment/Scripts/VRTKActions/FusedVRBehaviourBooleanAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace FusedVR.VRStreaming.VRTK | ||
{ | ||
using UnityEngine; | ||
using Zinnia.Action; | ||
using static FusedVR.VRStreaming.ControllerInputManager; | ||
|
||
/// <summary> | ||
/// Listens for the linked boolean behavior and emits the appropriate action. | ||
/// </summary> | ||
public class FusedVRBehaviourBooleanAction : BooleanAction | ||
{ | ||
[Tooltip("Manager to Listen for Input")] | ||
public ControllerInputManager inputManager; | ||
|
||
[Tooltip("Which hand should this behavior listen to") ] | ||
public Hand myHand; | ||
|
||
[Tooltip("Which button should this behavior listen to")] | ||
public Button myButton; | ||
|
||
private new void Start() { | ||
inputManager.VRButtonEvent.AddListener(OnRemoteUpdate); | ||
} | ||
|
||
private void OnDestroy() { | ||
inputManager.VRButtonEvent.RemoveListener(OnRemoteUpdate); | ||
} | ||
|
||
public void OnRemoteUpdate(Hand hand, Button button, bool pressed, bool touched) { | ||
if (hand == myHand && button == myButton) { | ||
Receive(pressed); // if my hand & button is pressed, then send data to VRTK | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Samples~/Asym-Apartment/Scripts/VRTKActions/FusedVRBehaviourBooleanAction.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
Samples~/Asym-Apartment/Scripts/VRTKActions/FusedVRBehaviourVector2Action.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace FusedVR.VRStreaming.VRTK { | ||
using UnityEngine; | ||
using Zinnia.Action; | ||
using static FusedVR.VRStreaming.ControllerInputManager; | ||
|
||
/// <summary> | ||
/// Listens for the linked boolean behavior and emits the appropriate action. | ||
/// </summary> | ||
public class FusedVRBehaviourVector2Action : Vector2Action { | ||
[Tooltip("Which hand should this behavior listen to")] | ||
public Hand myHand; | ||
|
||
[Tooltip("Which button should this behavior listen to")] | ||
public Button myButton; | ||
|
||
public void OnRemoteUpdate(Hand hand, Button button, float x, float y) { | ||
if (hand == myHand && button == myButton) { | ||
Receive(new Vector2(x , y)); // if my hand & button is pressed, then send data to VRTK | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Samples~/Asym-Apartment/Scripts/VRTKActions/FusedVRBehaviourVector2Action.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.