Add select exit event handling
parent
87f398cac3
commit
ecd1404c29
|
@ -78,8 +78,30 @@ Tree("32_Grotto_Kueche_Zwiebeln_schneiden") {
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
BTC.Show("GO/NamedSocketEvent.SOCKETS.RisottoSocket")
|
BTC.Show("GO/NamedSocketEvent.SOCKETS.RisottoSocket")
|
||||||
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
|
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
|
||||||
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
|
BTC.CompareEventTriggered("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto", "SelectEnter", "true")
|
||||||
BTC.Run("GO/NamedSocketEvent.SOCKETS.RisottoSocket")
|
//BTC.Run("AudioSource.AUDIO.Kueche2FZwiebelnsc")
|
||||||
|
|
||||||
|
|
||||||
|
BTC.Run("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
|
||||||
|
|
||||||
|
//BTC.Run("AudioSource.AUDIO.Kueche2FZwiebelnsc")
|
||||||
|
|
||||||
|
Composite(Race) {
|
||||||
|
Composite(Marathon) {
|
||||||
|
// Success
|
||||||
|
BTC.Run("GO/NamedSocketEvent.SOCKETS.RisottoSocket")
|
||||||
|
BTC.CompareEventTriggered("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto", "SelectExit", "true")
|
||||||
|
BTC.Hide("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto")
|
||||||
|
}
|
||||||
|
Composite(Sequence) {
|
||||||
|
// Fail
|
||||||
|
BTC.CompareEventTriggered("NamedGrabEvent/NamedOutline.INTERACTABLES.Risotto", "SelectExit", "true")
|
||||||
|
BTC.Wait(3)
|
||||||
|
BTC.Run("AudioSource.AUDIO.Kueche2FZwiebelnsc")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Composite(Sequence) {
|
Composite(Sequence) {
|
||||||
BTC.Show("GO/NamedSocketEvent.SOCKETS.SalzSocket")
|
BTC.Show("GO/NamedSocketEvent.SOCKETS.SalzSocket")
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class NamedGrabEvent : ComponentHandler {
|
||||||
if (GetComponent<XRGrabInteractable>())
|
if (GetComponent<XRGrabInteractable>())
|
||||||
{
|
{
|
||||||
GetComponent<XRGrabInteractable>().selectEntered.AddListener(SelectEnterEventHandler);
|
GetComponent<XRGrabInteractable>().selectEntered.AddListener(SelectEnterEventHandler);
|
||||||
|
GetComponent<XRGrabInteractable>().selectExited.AddListener(SelectExitEventHandler);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Debug.LogWarning($"NamedGrabEvent '{gameObject.name}' could not attach grab event (missing XR Grab Interactable?)");
|
Debug.LogWarning($"NamedGrabEvent '{gameObject.name}' could not attach grab event (missing XR Grab Interactable?)");
|
||||||
|
@ -42,23 +43,29 @@ public class NamedGrabEvent : ComponentHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public string objName = "GrabObjXY";
|
public string objName = "GrabObjXY";
|
||||||
private bool triggered = false;
|
private bool selectEnterTriggered = false;
|
||||||
|
private bool selectExitTriggered = false;
|
||||||
|
|
||||||
public void SelectEnterEventHandler(SelectEnterEventArgs args)
|
private void SelectEnterEventHandler(SelectEnterEventArgs args)
|
||||||
{
|
{
|
||||||
triggered = true;
|
selectEnterTriggered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectExitEventHandler(SelectExitEventArgs args)
|
||||||
|
{
|
||||||
|
selectExitTriggered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string titleText {
|
public override string titleText {
|
||||||
get {
|
get {
|
||||||
return "Run: Will Succeed on Select Enter Event";
|
return "Run: Will Succeed on Select Enter and Exit Event";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string[][] helpText {
|
public override string[][] helpText {
|
||||||
get {
|
get {
|
||||||
return new string[][] {
|
return new string[][] {
|
||||||
new string[] {"Run", "Return Success on Select Enter Event", $"BTC.Run(\"{roomId}\", \"{gameObject.name}\")"},
|
new string[] {"Run", "Return Success on Select Enter and Exit Event", $"BTC.Run(\"{roomId}\", \"{gameObject.name}\")"},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,16 +73,64 @@ public class NamedGrabEvent : ComponentHandler {
|
||||||
public override void Run(MyBT.NodeState nodeState) {
|
public override void Run(MyBT.NodeState nodeState) {
|
||||||
if (nodeState == NodeState.FirstRun) {
|
if (nodeState == NodeState.FirstRun) {
|
||||||
// reset event trigger at start
|
// reset event trigger at start
|
||||||
triggered = false;
|
selectEnterTriggered = false;
|
||||||
|
selectExitTriggered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodeState == NodeState.Aborting) {
|
if (nodeState == NodeState.Aborting) {
|
||||||
triggered = false;
|
selectEnterTriggered = false;
|
||||||
|
selectExitTriggered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triggered) {
|
if (selectEnterTriggered) {
|
||||||
|
Task.SetSucceeded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectExitTriggered)
|
||||||
|
{
|
||||||
Task.SetSucceeded();
|
Task.SetSucceeded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Task]
|
||||||
|
public void CompareEventTriggered(MyBT.NodeState nodeState, string key, bool value)
|
||||||
|
{
|
||||||
|
if ((nodeState == NodeState.FirstRun) || (nodeState == NodeState.Running))
|
||||||
|
{
|
||||||
|
if (key == "SelectEnter")
|
||||||
|
{
|
||||||
|
if (selectEnterTriggered == value)
|
||||||
|
{
|
||||||
|
Debug.Log($"CompareEventTriggered {key} with {value} = equal");
|
||||||
|
Task.SetSucceeded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log($"CompareEventTriggered {key} with {value} = not equal");
|
||||||
|
Task.SetFailed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key == "SelectExit")
|
||||||
|
{
|
||||||
|
if (selectExitTriggered == value)
|
||||||
|
{
|
||||||
|
Debug.Log($"CompareEventTriggered {key} with {value} = equal");
|
||||||
|
Task.SetSucceeded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log($"CompareEventTriggered {key} with {value} = not equal");
|
||||||
|
Task.SetFailed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Task.SetFailed();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2024-08-12T12:08:31.2245540Z
|
2024-08-14T15:25:32.9708470Z
|
|
@ -5379,7 +5379,7 @@ MonoBehaviour:
|
||||||
m_InteractableHoverScale: 1
|
m_InteractableHoverScale: 1
|
||||||
m_RecycleDelayTime: 1
|
m_RecycleDelayTime: 1
|
||||||
m_HoverSocketSnapping: 0
|
m_HoverSocketSnapping: 0
|
||||||
m_SocketSnappingRadius: 0.1
|
m_SocketSnappingRadius: 0.15
|
||||||
m_SocketScaleMode: 0
|
m_SocketScaleMode: 0
|
||||||
m_FixedScale: {x: 1, y: 1, z: 1}
|
m_FixedScale: {x: 1, y: 1, z: 1}
|
||||||
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
||||||
|
@ -5758,7 +5758,7 @@ MonoBehaviour:
|
||||||
m_InteractableHoverScale: 1
|
m_InteractableHoverScale: 1
|
||||||
m_RecycleDelayTime: 1
|
m_RecycleDelayTime: 1
|
||||||
m_HoverSocketSnapping: 0
|
m_HoverSocketSnapping: 0
|
||||||
m_SocketSnappingRadius: 0.1
|
m_SocketSnappingRadius: 0.15
|
||||||
m_SocketScaleMode: 0
|
m_SocketScaleMode: 0
|
||||||
m_FixedScale: {x: 1, y: 1, z: 1}
|
m_FixedScale: {x: 1, y: 1, z: 1}
|
||||||
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
||||||
|
@ -107987,7 +107987,7 @@ MonoBehaviour:
|
||||||
m_InteractableHoverScale: 1
|
m_InteractableHoverScale: 1
|
||||||
m_RecycleDelayTime: 1
|
m_RecycleDelayTime: 1
|
||||||
m_HoverSocketSnapping: 0
|
m_HoverSocketSnapping: 0
|
||||||
m_SocketSnappingRadius: 0.1
|
m_SocketSnappingRadius: 0.15
|
||||||
m_SocketScaleMode: 0
|
m_SocketScaleMode: 0
|
||||||
m_FixedScale: {x: 1, y: 1, z: 1}
|
m_FixedScale: {x: 1, y: 1, z: 1}
|
||||||
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
||||||
|
@ -108741,7 +108741,7 @@ MonoBehaviour:
|
||||||
m_InteractableHoverScale: 1
|
m_InteractableHoverScale: 1
|
||||||
m_RecycleDelayTime: 1
|
m_RecycleDelayTime: 1
|
||||||
m_HoverSocketSnapping: 0
|
m_HoverSocketSnapping: 0
|
||||||
m_SocketSnappingRadius: 0.1
|
m_SocketSnappingRadius: 0.15
|
||||||
m_SocketScaleMode: 0
|
m_SocketScaleMode: 0
|
||||||
m_FixedScale: {x: 1, y: 1, z: 1}
|
m_FixedScale: {x: 1, y: 1, z: 1}
|
||||||
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
||||||
|
@ -212863,7 +212863,7 @@ MonoBehaviour:
|
||||||
m_InteractableHoverScale: 1
|
m_InteractableHoverScale: 1
|
||||||
m_RecycleDelayTime: 1
|
m_RecycleDelayTime: 1
|
||||||
m_HoverSocketSnapping: 0
|
m_HoverSocketSnapping: 0
|
||||||
m_SocketSnappingRadius: 0.1
|
m_SocketSnappingRadius: 0.15
|
||||||
m_SocketScaleMode: 0
|
m_SocketScaleMode: 0
|
||||||
m_FixedScale: {x: 1, y: 1, z: 1}
|
m_FixedScale: {x: 1, y: 1, z: 1}
|
||||||
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
||||||
|
@ -213016,6 +213016,10 @@ PrefabInstance:
|
||||||
propertyPath: m_InteractionLayers.m_Bits
|
propertyPath: m_InteractionLayers.m_Bits
|
||||||
value: 4294967295
|
value: 4294967295
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4395678103393010410, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
|
propertyPath: m_InteractionLayers.m_Bits
|
||||||
|
value: 4294967295
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5615218200109173614, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
- target: {fileID: 5615218200109173614, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
propertyPath: m_RotationAction.m_Reference
|
propertyPath: m_RotationAction.m_Reference
|
||||||
value:
|
value:
|
||||||
|
@ -213064,6 +213068,10 @@ PrefabInstance:
|
||||||
propertyPath: m_InteractionLayers.m_Bits
|
propertyPath: m_InteractionLayers.m_Bits
|
||||||
value: 4294967295
|
value: 4294967295
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7973328002167281074, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
|
propertyPath: m_InteractionLayers.m_Bits
|
||||||
|
value: 4294967295
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8733093507751517968, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
- target: {fileID: 8733093507751517968, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: -6.699
|
value: -6.699
|
||||||
|
@ -213074,7 +213082,27 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8733093507751517968, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
- target: {fileID: 8733093507751517968, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: -17.993
|
value: -18.266
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8733093507751517968, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 0.64278764
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8733093507751517968, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8733093507751517968, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: -0.7660445
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8733093507751517968, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8733093507751517968, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: -100
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 9132913291935407762, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
- target: {fileID: 9132913291935407762, guid: 5eccbf4be2c00e94689ee8062e4e7276, type: 3}
|
||||||
propertyPath: m_RequestedTrackingOriginMode
|
propertyPath: m_RequestedTrackingOriginMode
|
||||||
|
@ -214612,7 +214640,7 @@ MonoBehaviour:
|
||||||
overrideLogStringDisplay: 0
|
overrideLogStringDisplay: 0
|
||||||
overrideDebugInternalActive: 0
|
overrideDebugInternalActive: 0
|
||||||
overrideDebugChangesActive: 0
|
overrideDebugChangesActive: 0
|
||||||
instanceID: 360798
|
instanceID: 249696
|
||||||
__behaviourTreeGenerator: {fileID: 0}
|
__behaviourTreeGenerator: {fileID: 0}
|
||||||
taskScripts:
|
taskScripts:
|
||||||
- {fileID: 4900000, guid: 7100bc138828c402baf6fdd9c426735b, type: 3}
|
- {fileID: 4900000, guid: 7100bc138828c402baf6fdd9c426735b, type: 3}
|
||||||
|
@ -214875,7 +214903,7 @@ MonoBehaviour:
|
||||||
m_InteractableHoverScale: 1
|
m_InteractableHoverScale: 1
|
||||||
m_RecycleDelayTime: 1
|
m_RecycleDelayTime: 1
|
||||||
m_HoverSocketSnapping: 0
|
m_HoverSocketSnapping: 0
|
||||||
m_SocketSnappingRadius: 0.1
|
m_SocketSnappingRadius: 0.15
|
||||||
m_SocketScaleMode: 0
|
m_SocketScaleMode: 0
|
||||||
m_FixedScale: {x: 1, y: 1, z: 1}
|
m_FixedScale: {x: 1, y: 1, z: 1}
|
||||||
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
m_TargetBoundsSize: {x: 1, y: 1, z: 1}
|
||||||
|
|
Loading…
Reference in New Issue