Skip to content

Commit

Permalink
Missing VRTK scripts for Apartment
Browse files Browse the repository at this point in the history
  • Loading branch information
vmohan7 committed Sep 25, 2021
1 parent 2e332d1 commit 90984ed
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
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
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 90984ed

Please sign in to comment.