File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,20 @@ public class DebugCheatsManager : NetworkBehaviour
27
27
[ SerializeField ]
28
28
KeyCode m_OpenWindowKeyCode = KeyCode . Slash ;
29
29
30
+ ServerSwitchedDoor m_ServerSwitchedDoor ;
31
+
32
+ ServerSwitchedDoor ServerSwitchedDoor
33
+ {
34
+ get
35
+ {
36
+ if ( m_ServerSwitchedDoor == null )
37
+ {
38
+ m_ServerSwitchedDoor = FindObjectOfType < ServerSwitchedDoor > ( ) ;
39
+ }
40
+ return m_ServerSwitchedDoor ;
41
+ }
42
+ }
43
+
30
44
const int k_NbTouchesToOpenWindow = 4 ;
31
45
32
46
void Update ( )
@@ -92,7 +106,7 @@ public void ToggleTeleportMode()
92
106
93
107
public void ToggleDoor ( )
94
108
{
95
- LogCheatNotImplemented ( "ToggleDoor" ) ;
109
+ ToggleDoorServerRpc ( ) ;
96
110
}
97
111
98
112
public void TogglePortals ( )
@@ -197,6 +211,20 @@ void HealPlayerServerRpc(ServerRpcParams serverRpcParams = default)
197
211
}
198
212
}
199
213
214
+ [ ServerRpc ( RequireOwnership = false ) ]
215
+ void ToggleDoorServerRpc ( ServerRpcParams serverRpcParams = default )
216
+ {
217
+ if ( ServerSwitchedDoor != null )
218
+ {
219
+ ServerSwitchedDoor . ForceOpen = ! ServerSwitchedDoor . ForceOpen ;
220
+ LogCheatUsedClientRPC ( serverRpcParams . Receive . SenderClientId , "ToggleDoor" ) ;
221
+ }
222
+ else
223
+ {
224
+ UnityEngine . Debug . Log ( "Could not activate ToggleDoor cheat. Door not found." ) ;
225
+ }
226
+ }
227
+
200
228
[ ServerRpc ( RequireOwnership = false ) ]
201
229
void GoToPostGameServerRpc ( ServerRpcParams serverRpcParams = default )
202
230
{
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ public class ServerSwitchedDoor : NetworkBehaviour
26
26
[ SerializeField , HideInInspector ]
27
27
int m_AnimatorDoorOpenBoolID ;
28
28
29
+ #if UNITY_EDITOR || DEVELOPMENT_BUILD
30
+ public bool ForceOpen ;
31
+ #endif
32
+
29
33
void Awake ( )
30
34
{
31
35
// don't let Update() run until after OnNetworkSpawn()
@@ -56,6 +60,10 @@ void Update()
56
60
}
57
61
}
58
62
63
+ #if UNITY_EDITOR || DEVELOPMENT_BUILD
64
+ isAnySwitchOn |= ForceOpen ;
65
+ #endif
66
+
59
67
m_NetworkDoorState . IsOpen . Value = isAnySwitchOn ;
60
68
}
61
69
You can’t perform that action at this time.
0 commit comments