BT function for aborting events; Controller Input Handler for Speech
parent
cf3ff5a5d1
commit
2c3f796138
|
@ -4,6 +4,7 @@
|
||||||
//RunTree("32_Grotto_Kueche_Intro")
|
//RunTree("32_Grotto_Kueche_Intro")
|
||||||
//RunTree("32_Grotto_Kueche_Zwiebeln_schneiden")
|
//RunTree("32_Grotto_Kueche_Zwiebeln_schneiden")
|
||||||
RunTree("32_Grotto_Kueche_alles_gefunden")
|
RunTree("32_Grotto_Kueche_alles_gefunden")
|
||||||
|
//RunTree("32_Grotto_Kueche_Kochen_Anzahl")
|
||||||
//RunTree("32_Grotto_Kueche_Zusammen_Kochen")
|
//RunTree("32_Grotto_Kueche_Zusammen_Kochen")
|
||||||
|
|
||||||
//RunTree("32_Grotto_Story_B_Grotto")
|
//RunTree("32_Grotto_Story_B_Grotto")
|
||||||
|
@ -84,6 +85,7 @@ Tree("32_Grotto_Story_B_Grotto") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
BTC.Wait(5)
|
BTC.Wait(5)
|
||||||
BTC.CompareUserSpeechInputStarted(false)
|
BTC.CompareUserSpeechInputStarted(false)
|
||||||
|
BTC.AbortSpeechEventListener()
|
||||||
BTC.StopSpeechIntentRecognition()
|
BTC.StopSpeechIntentRecognition()
|
||||||
BTC.ClearPossbileSpeechIntents()
|
BTC.ClearPossbileSpeechIntents()
|
||||||
|
|
||||||
|
@ -197,7 +199,6 @@ Tree("32_Grotto_Story_B_Grotto_Antwort_Nonna_Grotto") {
|
||||||
BTC.CompareUserSpeechInputStarted(false)
|
BTC.CompareUserSpeechInputStarted(false)
|
||||||
BTC.StopSpeechIntentRecognition()
|
BTC.StopSpeechIntentRecognition()
|
||||||
BTC.ClearPossbileSpeechIntents()
|
BTC.ClearPossbileSpeechIntents()
|
||||||
//BTC.GetKeyDown("Return")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,17 +374,19 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
|
||||||
Tree("32_Grotto_Kueche_alles_gefunden") {
|
Tree("32_Grotto_Kueche_alles_gefunden") {
|
||||||
// --- Kueche - alles gefunden ---
|
// --- Kueche - alles gefunden ---
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
BTC.Run("AudioSource.AUDIO.Kueche2Fallesgefun") // Audio fehlt
|
BTC.SynthesizeText("Super, du hast alles gefunden. Bitte gib nun etwas Olivenöl in den Topf.", "de-DE", "")
|
||||||
|
BTC.SpeechOutputEnded()
|
||||||
|
|
||||||
// Oel in Topf geben - Particle Trigger
|
// Oel in Topf geben - Particle Trigger
|
||||||
// ...
|
// ...
|
||||||
BTC.Run("AudioSource.AUDIO.Kueche2Fallesgefun")
|
BTC.Run("AudioSource.AUDIO.Kueche2Fallesgefun")
|
||||||
BTC.GetKeyDown("Return")
|
//BTC.GetKeyDown("Return")
|
||||||
|
|
||||||
// Zwiebeln in Topf geben
|
// Zwiebeln in Topf geben
|
||||||
/* BTC.Run("NamedGrabEvent.INTERACTABLES.Zwiebeln")
|
BTC.Run("NamedGrabEvent.INTERACTABLES.Zwiebeln")
|
||||||
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Zwiebeln")
|
BTC.Set("Collider.INTERACTABLES.Topf", "otherTag", "Zwiebeln")
|
||||||
BTC.Run("Collider.INTERACTABLES.Topf")
|
BTC.Run("Collider.INTERACTABLES.Topf")
|
||||||
BTC.Run("AudioSource.AUDIO.Kueche3Fallesgefun")*/
|
BTC.Run("AudioSource.AUDIO.Kueche3Fallesgefun")
|
||||||
|
|
||||||
// Frage beantworten
|
// Frage beantworten
|
||||||
BTC.AddPossbileSpeechIntent("Kueche.alles_gefunden.4", "Ja.")
|
BTC.AddPossbileSpeechIntent("Kueche.alles_gefunden.4", "Ja.")
|
||||||
|
@ -431,6 +434,7 @@ Tree("32_Grotto_Kueche_alles_gefunden") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
// Ja
|
// Ja
|
||||||
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
|
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
|
||||||
|
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option1Button")
|
BTC.Hide("GO.HANDMENU.Option1Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option2Button")
|
BTC.Hide("GO.HANDMENU.Option2Button")
|
||||||
RunTree("32_Grotto_Kueche_Interesse_Kochen")
|
RunTree("32_Grotto_Kueche_Interesse_Kochen")
|
||||||
|
@ -438,6 +442,7 @@ Tree("32_Grotto_Kueche_alles_gefunden") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
// Nein
|
// Nein
|
||||||
BTC.Run("NamedEventTrigger.HANDMENU.Option2Button")
|
BTC.Run("NamedEventTrigger.HANDMENU.Option2Button")
|
||||||
|
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option1Button")
|
BTC.Hide("GO.HANDMENU.Option1Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option2Button")
|
BTC.Hide("GO.HANDMENU.Option2Button")
|
||||||
RunTree("32_Grotto_Kueche_Zusammen_Kochen")
|
RunTree("32_Grotto_Kueche_Zusammen_Kochen")
|
||||||
|
@ -451,6 +456,7 @@ Tree("32_Grotto_Kueche_alles_gefunden") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
BTC.Wait(5)
|
BTC.Wait(5)
|
||||||
BTC.CompareUserSpeechInputStarted(false)
|
BTC.CompareUserSpeechInputStarted(false)
|
||||||
|
BTC.AbortSpeechEventListener()
|
||||||
BTC.StopSpeechIntentRecognition()
|
BTC.StopSpeechIntentRecognition()
|
||||||
BTC.ClearPossbileSpeechIntents()
|
BTC.ClearPossbileSpeechIntents()
|
||||||
|
|
||||||
|
@ -466,6 +472,7 @@ Tree("32_Grotto_Kueche_alles_gefunden") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
// Ja
|
// Ja
|
||||||
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
|
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
|
||||||
|
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option1Button")
|
BTC.Hide("GO.HANDMENU.Option1Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option2Button")
|
BTC.Hide("GO.HANDMENU.Option2Button")
|
||||||
RunTree("32_Grotto_Kueche_Interesse_Kochen")
|
RunTree("32_Grotto_Kueche_Interesse_Kochen")
|
||||||
|
@ -473,6 +480,7 @@ Tree("32_Grotto_Kueche_alles_gefunden") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
// Nein
|
// Nein
|
||||||
BTC.Run("NamedEventTrigger.HANDMENU.Option2Button")
|
BTC.Run("NamedEventTrigger.HANDMENU.Option2Button")
|
||||||
|
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option1Button")
|
BTC.Hide("GO.HANDMENU.Option1Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option2Button")
|
BTC.Hide("GO.HANDMENU.Option2Button")
|
||||||
RunTree("32_Grotto_Kueche_Zusammen_Kochen")
|
RunTree("32_Grotto_Kueche_Zusammen_Kochen")
|
||||||
|
@ -494,8 +502,7 @@ Tree("32_Grotto_Kueche_Interesse_Kochen") {
|
||||||
Composite(Race) {
|
Composite(Race) {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
// Lieblingsessen nennen
|
// Lieblingsessen nennen
|
||||||
//BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
|
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
|
||||||
BTC.GetKeyDown("Return")
|
|
||||||
BTC.SetBool("32_Grotto_Kueche_Interesse_Kochen_Button_Clicked")
|
BTC.SetBool("32_Grotto_Kueche_Interesse_Kochen_Button_Clicked")
|
||||||
BTC.Hide("GO.HANDMENU.Option1Button")
|
BTC.Hide("GO.HANDMENU.Option1Button")
|
||||||
RunTree("32_Grotto_Kueche_Kochen_Anzahl")
|
RunTree("32_Grotto_Kueche_Kochen_Anzahl")
|
||||||
|
@ -562,6 +569,7 @@ Tree("32_Grotto_Kueche_Kochen_Anzahl") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
// sehr oft
|
// sehr oft
|
||||||
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
|
BTC.Run("NamedEventTrigger.HANDMENU.Option1Button")
|
||||||
|
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option2Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option1Button")
|
BTC.Hide("GO.HANDMENU.Option1Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option2Button")
|
BTC.Hide("GO.HANDMENU.Option2Button")
|
||||||
RunTree("32_Grotto_Kueche_Selbststaendig_Kochen")
|
RunTree("32_Grotto_Kueche_Selbststaendig_Kochen")
|
||||||
|
@ -569,6 +577,7 @@ Tree("32_Grotto_Kueche_Kochen_Anzahl") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
// selten
|
// selten
|
||||||
BTC.Run("NamedEventTrigger.HANDMENU.Option2Button")
|
BTC.Run("NamedEventTrigger.HANDMENU.Option2Button")
|
||||||
|
BTC.AbortEventListener("NamedEventTrigger.HANDMENU.Option1Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option1Button")
|
BTC.Hide("GO.HANDMENU.Option1Button")
|
||||||
BTC.Hide("GO.HANDMENU.Option2Button")
|
BTC.Hide("GO.HANDMENU.Option2Button")
|
||||||
RunTree("32_Grotto_Kueche_Zusammen_Kochen")
|
RunTree("32_Grotto_Kueche_Zusammen_Kochen")
|
||||||
|
@ -582,6 +591,7 @@ Tree("32_Grotto_Kueche_Kochen_Anzahl") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
BTC.Wait(5)
|
BTC.Wait(5)
|
||||||
BTC.CompareUserSpeechInputStarted(false)
|
BTC.CompareUserSpeechInputStarted(false)
|
||||||
|
BTC.AbortSpeechEventListener()
|
||||||
BTC.StopSpeechIntentRecognition()
|
BTC.StopSpeechIntentRecognition()
|
||||||
BTC.ClearPossbileSpeechIntents()
|
BTC.ClearPossbileSpeechIntents()
|
||||||
RunTree("32_Grotto_Kueche_Zusammen_Kochen")
|
RunTree("32_Grotto_Kueche_Zusammen_Kochen")
|
||||||
|
@ -722,6 +732,7 @@ Tree("32_Grotto_Kueche_Parmigiano") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
BTC.Wait(5)
|
BTC.Wait(5)
|
||||||
BTC.CompareUserSpeechInputStarted(false)
|
BTC.CompareUserSpeechInputStarted(false)
|
||||||
|
BTC.AbortSpeechEventListener()
|
||||||
BTC.StopSpeechIntentRecognition()
|
BTC.StopSpeechIntentRecognition()
|
||||||
BTC.ClearPossbileSpeechIntents()
|
BTC.ClearPossbileSpeechIntents()
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,6 +252,18 @@ public class BTC : MonoBehaviour {
|
||||||
Task.SetSucceeded();
|
Task.SetSucceeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Task]
|
||||||
|
public void AbortEventListener(string objectName)
|
||||||
|
{
|
||||||
|
List<ComponentHandler> handlers = GetHandlers(objectName);
|
||||||
|
handlers.ForEach(handler => handler.AbortEventListener(Task.getState));
|
||||||
|
if (handlers.Count == 0)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"BTC.AbortEventListener: no components under the name '{objectName}'");
|
||||||
|
Task.SetSucceeded();
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region video & sound tasks
|
#region video & sound tasks
|
||||||
|
@ -618,6 +630,7 @@ public class BTC : MonoBehaviour {
|
||||||
private bool _onIntentRecognitionFailedEventTriggered = false;
|
private bool _onIntentRecognitionFailedEventTriggered = false;
|
||||||
private bool _onSpeechOutputStartedEventTriggered = false;
|
private bool _onSpeechOutputStartedEventTriggered = false;
|
||||||
private bool _onSpeechOutputEndedEventTriggered = false;
|
private bool _onSpeechOutputEndedEventTriggered = false;
|
||||||
|
private bool _abortSpeechEventListener = false;
|
||||||
|
|
||||||
void OnDisable()
|
void OnDisable()
|
||||||
{
|
{
|
||||||
|
@ -735,6 +748,15 @@ public class BTC : MonoBehaviour {
|
||||||
if (_onUserSpeechInputStartedEventTriggered)
|
if (_onUserSpeechInputStartedEventTriggered)
|
||||||
{
|
{
|
||||||
Task.SetSucceeded();
|
Task.SetSucceeded();
|
||||||
|
Debug.Log("UserStartedSpeechInput succeded.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_abortSpeechEventListener)
|
||||||
|
{
|
||||||
|
Task.SetFailed();
|
||||||
|
Debug.Log("UserStartedSpeechInput failed.");
|
||||||
|
_abortSpeechEventListener = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -797,6 +819,17 @@ public class BTC : MonoBehaviour {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Task]
|
||||||
|
public void AbortSpeechEventListener()
|
||||||
|
{
|
||||||
|
if (Task.getState == NodeState.FirstRun)
|
||||||
|
{
|
||||||
|
_abortSpeechEventListener = true;
|
||||||
|
Task.SetSucceeded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Task]
|
[Task]
|
||||||
public void ClearPossbileSpeechIntents()
|
public void ClearPossbileSpeechIntents()
|
||||||
{
|
{
|
||||||
|
|
|
@ -207,6 +207,15 @@ public class ComponentHandler : MonoBehaviour {
|
||||||
Task.SetError();
|
Task.SetError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void AbortEventListener(MyBT.NodeState nodeState)
|
||||||
|
{
|
||||||
|
if (Task.isDebugging)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"ComponentHandler.AbortEventListener: not implemented for {this.GetType()}");
|
||||||
|
}
|
||||||
|
Task.SetError();
|
||||||
|
}
|
||||||
|
|
||||||
protected float sourceAlpha;
|
protected float sourceAlpha;
|
||||||
protected float targetAlpha;
|
protected float targetAlpha;
|
||||||
protected float timeSum;
|
protected float timeSum;
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class NamedEventTrigger : ComponentHandler {
|
||||||
EventTrigger eventTrigger;
|
EventTrigger eventTrigger;
|
||||||
|
|
||||||
private bool triggered = false;
|
private bool triggered = false;
|
||||||
|
private bool _abortEventListener = false;
|
||||||
|
|
||||||
public void PointerClickEventHandler () {
|
public void PointerClickEventHandler () {
|
||||||
triggered = true;
|
triggered = true;
|
||||||
|
@ -86,6 +87,25 @@ public class NamedEventTrigger : ComponentHandler {
|
||||||
|
|
||||||
if (triggered) {
|
if (triggered) {
|
||||||
ToggleActive(false);
|
ToggleActive(false);
|
||||||
|
Debug.Log($"NamedEventTrigger on {gameObject.name} succeded.");
|
||||||
|
Task.SetSucceeded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_abortEventListener)
|
||||||
|
{
|
||||||
|
Task.SetFailed();
|
||||||
|
Debug.Log($"NamedEventTrigger on {gameObject.name} failed.");
|
||||||
|
_abortEventListener = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AbortEventListener(MyBT.NodeState nodeState)
|
||||||
|
{
|
||||||
|
if (nodeState == NodeState.FirstRun)
|
||||||
|
{
|
||||||
|
_abortEventListener = true;
|
||||||
Task.SetSucceeded();
|
Task.SetSucceeded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,174 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &5714472087302188827
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 5021853568501081044}
|
||||||
|
- component: {fileID: 1222158309809647475}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: SpeechControllerInputHandler
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &5021853568501081044
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5714472087302188827}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1222158309809647475
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5714472087302188827}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: f3657284cbc344c10b72aff76116332b, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
actionA:
|
||||||
|
m_Name: Action A
|
||||||
|
m_Type: 0
|
||||||
|
m_ExpectedControlType:
|
||||||
|
m_Id: e977869f-e3af-44af-9a86-31776e76a0d1
|
||||||
|
m_Processors:
|
||||||
|
m_Interactions:
|
||||||
|
m_SingletonActionBindings:
|
||||||
|
- m_Name:
|
||||||
|
m_Id: 8d3a4a4e-953c-412b-840e-1f6248f6ddc3
|
||||||
|
m_Path: <XRController>{RightHand}/{PrimaryButton}
|
||||||
|
m_Interactions:
|
||||||
|
m_Processors:
|
||||||
|
m_Groups:
|
||||||
|
m_Action: Action A
|
||||||
|
m_Flags: 0
|
||||||
|
m_Flags: 0
|
||||||
|
OnPressA:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 0}
|
||||||
|
m_TargetAssemblyTypeName: ViaggioAIDemo, Assembly-CSharp
|
||||||
|
m_MethodName: StartMockIntentRecognition
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
actionB:
|
||||||
|
m_Name: Action B
|
||||||
|
m_Type: 0
|
||||||
|
m_ExpectedControlType:
|
||||||
|
m_Id: f7f49635-d0f7-4c67-bcf2-bdce6be23b9a
|
||||||
|
m_Processors:
|
||||||
|
m_Interactions:
|
||||||
|
m_SingletonActionBindings:
|
||||||
|
- m_Name:
|
||||||
|
m_Id: 37ad56d9-90f3-466b-9764-83fa5a4f6896
|
||||||
|
m_Path: <XRController>{RightHand}/{SecondaryButton}
|
||||||
|
m_Interactions:
|
||||||
|
m_Processors:
|
||||||
|
m_Groups:
|
||||||
|
m_Action: Action B
|
||||||
|
m_Flags: 0
|
||||||
|
m_Flags: 0
|
||||||
|
OnPressB:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 0}
|
||||||
|
m_TargetAssemblyTypeName: ViaggioAIDemo, Assembly-CSharp
|
||||||
|
m_MethodName: GotoNextMockIntent
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
actionX:
|
||||||
|
m_Name: Action X
|
||||||
|
m_Type: 0
|
||||||
|
m_ExpectedControlType:
|
||||||
|
m_Id: a792d5f0-00e7-42e4-9339-87923e0c6f39
|
||||||
|
m_Processors:
|
||||||
|
m_Interactions:
|
||||||
|
m_SingletonActionBindings:
|
||||||
|
- m_Name:
|
||||||
|
m_Id: a55929c1-9629-478b-9da0-e3023fb49299
|
||||||
|
m_Path: <XRController>{LeftHand}/{PrimaryButton}
|
||||||
|
m_Interactions:
|
||||||
|
m_Processors:
|
||||||
|
m_Groups:
|
||||||
|
m_Action: Action X
|
||||||
|
m_Flags: 0
|
||||||
|
m_Flags: 0
|
||||||
|
OnPressX:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 0}
|
||||||
|
m_TargetAssemblyTypeName: ViaggioAIManager, Assembly-CSharp
|
||||||
|
m_MethodName: StopIntentRecognition
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
actionY:
|
||||||
|
m_Name: Action Y
|
||||||
|
m_Type: 0
|
||||||
|
m_ExpectedControlType:
|
||||||
|
m_Id: 9053e886-15bb-49ac-993f-43f58197c97f
|
||||||
|
m_Processors:
|
||||||
|
m_Interactions:
|
||||||
|
m_SingletonActionBindings:
|
||||||
|
- m_Name:
|
||||||
|
m_Id: 943113c4-2c8b-49ec-b74d-896cfa8467d9
|
||||||
|
m_Path: <XRController>{LeftHand}/{SecondaryButton}
|
||||||
|
m_Interactions:
|
||||||
|
m_Processors:
|
||||||
|
m_Groups:
|
||||||
|
m_Action: Action Y
|
||||||
|
m_Flags: 0
|
||||||
|
m_Flags: 0
|
||||||
|
OnPressY:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 0}
|
||||||
|
m_TargetAssemblyTypeName: ViaggioAIDemo, Assembly-CSharp
|
||||||
|
m_MethodName: SynthesizeNextMockText
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 33faae782c834443b9773435cb632e69
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1 +1 @@
|
||||||
2024-09-18T14:25:36.7119300Z
|
2024-09-23T15:03:45.7173120Z
|
File diff suppressed because it is too large
Load Diff
|
@ -7,33 +7,67 @@ using UnityEngine.InputSystem;
|
||||||
public class OnButtonPress : MonoBehaviour
|
public class OnButtonPress : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Tooltip("Actions to check")]
|
[Tooltip("Actions to check")]
|
||||||
public InputAction action = null;
|
public InputAction actionA = null;
|
||||||
|
public UnityEvent OnPressA = new UnityEvent();
|
||||||
|
|
||||||
// When the button is pressed
|
public InputAction actionB = null;
|
||||||
public UnityEvent OnPress = new UnityEvent();
|
public UnityEvent OnPressB = new UnityEvent();
|
||||||
|
|
||||||
|
public InputAction actionX = null;
|
||||||
|
public UnityEvent OnPressX = new UnityEvent();
|
||||||
|
|
||||||
|
public InputAction actionY = null;
|
||||||
|
public UnityEvent OnPressY = new UnityEvent();
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
action.started += Pressed;
|
actionA.started += ButtonAPressed;
|
||||||
|
actionB.started += ButtonBPressed;
|
||||||
|
actionX.started += ButtonXPressed;
|
||||||
|
actionY.started += ButtonYPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
action.started -= Pressed;
|
actionA.started -= ButtonAPressed;
|
||||||
|
actionB.started -= ButtonBPressed;
|
||||||
|
actionX.started -= ButtonXPressed;
|
||||||
|
actionY.started -= ButtonYPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
action.Enable();
|
actionA.Enable();
|
||||||
|
actionB.Enable();
|
||||||
|
actionX.Enable();
|
||||||
|
actionY.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
action.Disable();
|
actionA.Disable();
|
||||||
|
actionB.Disable();
|
||||||
|
actionX.Disable();
|
||||||
|
actionY.Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Pressed(InputAction.CallbackContext context)
|
private void ButtonAPressed(InputAction.CallbackContext context)
|
||||||
{
|
{
|
||||||
OnPress.Invoke();
|
OnPressA.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonBPressed(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
OnPressB.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonXPressed(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
OnPressX.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonYPressed(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
OnPressY.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue