Skip to content

Commit 9d1981f

Browse files
author
David Kline
authored
Merge pull request #2771 from StephenHodgson/vNEXT-InputActionRules
vNEXT: Input Action Rules
2 parents 749dc20 + c36933e commit 9d1981f

26 files changed

+1224
-10
lines changed

Assets/MixedRealityToolkit-SDK/Features/Input/MixedRealityInputManager.cs

Lines changed: 139 additions & 9 deletions
Large diffs are not rendered by default.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_PrefabParentObject: {fileID: 0}
7+
m_PrefabInternal: {fileID: 0}
8+
m_GameObject: {fileID: 0}
9+
m_Enabled: 1
10+
m_EditorHideFlags: 0
11+
m_Script: {fileID: 11500000, guid: ee54661ca8af487c9db40e57d479fa48, type: 3}
12+
m_Name: DefaultMixedRealityInputActionRulesProfile
13+
m_EditorClassIdentifier:
14+
isCustomProfile: 0
15+
inputActionRulesDigital: []
16+
inputActionRulesSingleAxis: []
17+
inputActionRulesDualAxis: []
18+
inputActionRulesVectorAxis: []
19+
inputActionRulesQuaternionAxis: []
20+
inputActionRulesPoseAxis: []

Assets/MixedRealityToolkit-SDK/Profiles/DefaultMixedRealityInputActionRulesProfile.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MixedRealityToolkit-SDK/Profiles/DefaultMixedRealityInputSystemProfile.asset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ MonoBehaviour:
1515
inputActionsProfile: {fileID: 11400000, guid: 723eb97b02944311b92861f473eee53e,
1616
type: 2}
1717
gesturesProfile: {fileID: 11400000, guid: bd7829a9b29409045a745b5a18299291, type: 2}
18+
inputActionRulesProfile: {fileID: 11400000, guid: 03945385d89102f41855bc8f5116b199,
19+
type: 2}
1820
pointerProfile: {fileID: 11400000, guid: 48aa63a9725047b28d4137fd0834bc31, type: 2}
1921
speechCommandsProfile: {fileID: 11400000, guid: e8d0393e66374dae9646851a57dc6bc1,
2022
type: 2}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
5+
using System;
6+
using UnityEngine;
7+
8+
namespace Microsoft.MixedReality.Toolkit.Core.Definitions.InputSystem
9+
{
10+
/// <summary>
11+
/// Generic Input Action Rule for raising actions based on specific criteria.
12+
/// </summary>
13+
[Serializable]
14+
public struct InputActionRuleDigital : IInputActionRule<bool>
15+
{
16+
/// <summary>
17+
/// Constructor.
18+
/// </summary>
19+
/// <param name="baseAction">The Base Action that the rule will listen to.</param>
20+
/// <param name="ruleAction">The Action to raise if the criteria is met.</param>
21+
/// <param name="criteria">The criteria to check against for determining if the action should be raised.</param>
22+
public InputActionRuleDigital(MixedRealityInputAction baseAction, MixedRealityInputAction ruleAction, bool criteria)
23+
{
24+
this.baseAction = baseAction;
25+
this.ruleAction = ruleAction;
26+
this.criteria = criteria;
27+
}
28+
29+
[SerializeField]
30+
[Tooltip("The Base Action that the rule will listen to.")]
31+
private MixedRealityInputAction baseAction;
32+
33+
/// <inheritdoc />
34+
public MixedRealityInputAction BaseAction => baseAction;
35+
36+
[SerializeField]
37+
[Tooltip("The Action to raise if the criteria is met.")]
38+
private MixedRealityInputAction ruleAction;
39+
40+
/// <inheritdoc />
41+
public MixedRealityInputAction RuleAction => ruleAction;
42+
43+
[SerializeField]
44+
[Tooltip("The criteria to check against for determining if the action should be raised.")]
45+
private bool criteria;
46+
47+
/// <inheritdoc />
48+
public bool Criteria => criteria;
49+
}
50+
}

Assets/MixedRealityToolkit/_Core/Definitions/InputSystem/InputActionRuleDigital.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
5+
using System;
6+
using UnityEngine;
7+
8+
namespace Microsoft.MixedReality.Toolkit.Core.Definitions.InputSystem
9+
{
10+
/// <summary>
11+
/// Generic Input Action Rule for raising actions based on specific criteria.
12+
/// </summary>
13+
[Serializable]
14+
public struct InputActionRuleDualAxis : IInputActionRule<Vector2>
15+
{
16+
/// <summary>
17+
/// Constructor.
18+
/// </summary>
19+
/// <param name="baseAction">The Base Action that the rule will listen to.</param>
20+
/// <param name="ruleAction">The Action to raise if the criteria is met.</param>
21+
/// <param name="criteria">The criteria to check against for determining if the action should be raised.</param>
22+
public InputActionRuleDualAxis(MixedRealityInputAction baseAction, MixedRealityInputAction ruleAction, Vector2 criteria)
23+
{
24+
this.baseAction = baseAction;
25+
this.ruleAction = ruleAction;
26+
this.criteria = criteria;
27+
}
28+
29+
[SerializeField]
30+
[Tooltip("The Base Action that the rule will listen to.")]
31+
private MixedRealityInputAction baseAction;
32+
33+
/// <inheritdoc />
34+
public MixedRealityInputAction BaseAction => baseAction;
35+
36+
[SerializeField]
37+
[Tooltip("The Action to raise if the criteria is met.")]
38+
private MixedRealityInputAction ruleAction;
39+
40+
/// <inheritdoc />
41+
public MixedRealityInputAction RuleAction => ruleAction;
42+
43+
[SerializeField]
44+
[Tooltip("The criteria to check against for determining if the action should be raised.")]
45+
private Vector2 criteria;
46+
47+
/// <inheritdoc />
48+
public Vector2 Criteria => criteria;
49+
}
50+
}

Assets/MixedRealityToolkit/_Core/Definitions/InputSystem/InputActionRuleDualAxis.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using Microsoft.MixedReality.Toolkit.Core.Definitions.Utilities;
5+
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
6+
using System;
7+
using UnityEngine;
8+
9+
namespace Microsoft.MixedReality.Toolkit.Core.Definitions.InputSystem
10+
{
11+
/// <summary>
12+
/// Generic Input Action Rule for raising actions based on specific criteria.
13+
/// </summary>
14+
[Serializable]
15+
public struct InputActionRulePoseAxis : IInputActionRule<MixedRealityPose>
16+
{
17+
/// <summary>
18+
/// Constructor.
19+
/// </summary>
20+
/// <param name="baseAction">The Base Action that the rule will listen to.</param>
21+
/// <param name="ruleAction">The Action to raise if the criteria is met.</param>
22+
/// <param name="criteria">The criteria to check against for determining if the action should be raised.</param>
23+
public InputActionRulePoseAxis(MixedRealityInputAction baseAction, MixedRealityInputAction ruleAction, MixedRealityPose criteria)
24+
{
25+
this.baseAction = baseAction;
26+
this.ruleAction = ruleAction;
27+
this.criteria = criteria;
28+
}
29+
30+
[SerializeField]
31+
[Tooltip("The Base Action that the rule will listen to.")]
32+
private MixedRealityInputAction baseAction;
33+
34+
/// <inheritdoc />
35+
public MixedRealityInputAction BaseAction => baseAction;
36+
37+
[SerializeField]
38+
[Tooltip("The Action to raise if the criteria is met.")]
39+
private MixedRealityInputAction ruleAction;
40+
41+
/// <inheritdoc />
42+
public MixedRealityInputAction RuleAction => ruleAction;
43+
44+
[SerializeField]
45+
[Tooltip("The criteria to check against for determining if the action should be raised.")]
46+
private MixedRealityPose criteria;
47+
48+
/// <inheritdoc />
49+
public MixedRealityPose Criteria => criteria;
50+
}
51+
}

Assets/MixedRealityToolkit/_Core/Definitions/InputSystem/InputActionRulePoseAxis.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)