OLD_STEP_LIST_EDITOR
Documentation for the Unity C# Library
Loading...
Searching...
No Matches
CheatListener.cs
Go to the documentation of this file.
1
using
System.Collections;
2
using
System.Collections.Generic;
3
using
Autohand.Demo;
4
using
UnityEngine;
5
6
namespace
PixoVR.Event
7
{
8
public
class
CheatListener
: MonoBehaviour
9
{
10
[SerializeField]
11
private
GameObject
debugUI
;
12
13
[SerializeField]
private
InteractableDebug
_interactableDebug
;
14
15
[SerializeField]
16
private
XRHandControllerLink
leftHandControllerLink
;
17
18
[SerializeField]
19
private
List<CommonButton>
_pressedButtons
;
20
21
private
int
counter
= 0;
22
private
bool
showDebugUI
=
false
;
23
private
bool
_secondaryButtonPressed
=
false
;
24
private
bool
_primaryButtonPressed
=
false
;
25
26
27
void
Update
()
28
{
29
if
(
showDebugUI
)
return
;
30
31
if
(
leftHandControllerLink
.ButtonPressed(CommonButton.secondaryButton) && !
_secondaryButtonPressed
)
32
{
33
_secondaryButtonPressed
=
true
;
34
CheckCombination
(CommonButton.secondaryButton);
35
}
36
37
if
(!
leftHandControllerLink
.ButtonPressed(CommonButton.secondaryButton) &&
_secondaryButtonPressed
)
38
{
39
_secondaryButtonPressed
=
false
;
40
}
41
42
43
if
(
leftHandControllerLink
.ButtonPressed(CommonButton.primaryButton) && !
_primaryButtonPressed
)
44
{
45
_primaryButtonPressed
=
true
;
46
CheckCombination
(CommonButton.primaryButton);
47
}
48
if
(!
leftHandControllerLink
.ButtonPressed(CommonButton.primaryButton) &&
_primaryButtonPressed
)
49
{
50
_primaryButtonPressed
=
false
;
51
}
52
}
53
54
private
void
CheckCombination
(CommonButton button)
55
{
56
if
(
_pressedButtons
[
counter
] == button)
57
{
58
++
counter
;
59
if
(
counter
==
_pressedButtons
.Count)
60
{
61
showDebugUI
=
true
;
62
debugUI
.SetActive(
true
);
63
_interactableDebug.CloseDebugUI += () =>
64
{
65
counter
= 0;
66
showDebugUI
=
false
;
67
debugUI
.SetActive(
false
);
68
};
69
}
70
}
71
else
72
{
73
counter
= 0;
74
}
75
}
76
}
77
}
PixoVR.Event.CheatListener
Definition
CheatListener.cs:9
PixoVR.Event.CheatListener.showDebugUI
bool showDebugUI
Definition
CheatListener.cs:43
PixoVR.Event.CheatListener.Update
void Update()
Definition
CheatListener.cs:48
PixoVR.Event.CheatListener._primaryButtonPressed
bool _primaryButtonPressed
Definition
CheatListener.cs:45
PixoVR.Event.CheatListener.counter
int counter
Definition
CheatListener.cs:42
PixoVR.Event.CheatListener.debugUI
GameObject debugUI
[SerializeField]
Definition
CheatListener.cs:14
PixoVR.Event.CheatListener._pressedButtons
List< CommonButton > _pressedButtons
[SerializeField]
Definition
CheatListener.cs:40
PixoVR.Event.CheatListener._interactableDebug
InteractableDebug _interactableDebug
[SerializeField]
Definition
CheatListener.cs:22
PixoVR.Event.CheatListener.leftHandControllerLink
XRHandControllerLink leftHandControllerLink
[SerializeField]
Definition
CheatListener.cs:31
PixoVR.Event.CheatListener._secondaryButtonPressed
bool _secondaryButtonPressed
Definition
CheatListener.cs:44
PixoVR.Event.CheatListener.CheckCombination
void CheckCombination(CommonButton button)
Definition
CheatListener.cs:75
PixoVR.Event.InteractableDebug
Definition
InteractableDebug.cs:13
PixoVR.Event
Definition
ItemIDAttribute.cs:5
com.pixovr.eventunitysdk
Runtime
Sdk
Scripts
CheatListener.cs
Generated
Wed Oct 9 2024 19:24:02
by Doxygen version
1.10.0