mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-25 16:15:39 -05:00
Merge branch 'PausePitfallFix'
This commit is contained in:
commit
34601c58b2
|
|
@ -201,6 +201,18 @@ public class PlayerStats : MonoBehaviour
|
|||
else if (GameObject.FindGameObjectWithTag("FogSystem").GetComponent<ParticleSystem>().isPlaying) {
|
||||
SetWeather(Weather.Fog);
|
||||
}
|
||||
|
||||
StartCoroutine(UnPause());
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator UnPause() {
|
||||
yield return new WaitForSecondsRealtime(3f);
|
||||
|
||||
if (gameObject.transform.root.GetComponentInChildren<PlayerStats>().IsPaused) {
|
||||
GameObject PauseMenu = GameObject.FindGameObjectWithTag("PauseMenu");
|
||||
PauseMenu.GetComponent<PauseMenu>().setPlayerControlsStateServerRPC(true);
|
||||
PauseMenu.GetComponent<PauseMenu>().TurnOffPanelServerRPC();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -353,6 +353,7 @@ public class LobbyUI : NetworkBehaviour {
|
|||
}
|
||||
|
||||
public void RefreshIPAddress() {
|
||||
if (!IsServer) { return; }
|
||||
StartCoroutine(GetIPAddress());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,27 @@ public class PauseMenu : NetworkBehaviour {
|
|||
ControlsPanel.SetActive(false);
|
||||
ConfirmationPanel.SetActive(false);
|
||||
RespawnConfirmationPanel.SetActive(false);
|
||||
|
||||
InvokeRepeating("checkForPaused", 0f, 2f);
|
||||
}
|
||||
|
||||
private void checkForPaused() {
|
||||
GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
|
||||
|
||||
foreach (GameObject player in players) {
|
||||
if (player.GetComponent<NetworkObject>().IsLocalPlayer) {
|
||||
if (player.GetComponentInChildren<PlayerStats>() != null)
|
||||
{
|
||||
if (!player.GetComponentInChildren<PlayerStats>().IsPaused)
|
||||
{
|
||||
PauseMenuPanel.SetActive(false);
|
||||
ControlsPanel.SetActive(false);
|
||||
ConfirmationPanel.SetActive(false);
|
||||
RespawnConfirmationPanel.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
|
|
@ -89,8 +110,6 @@ public class PauseMenu : NetworkBehaviour {
|
|||
// Turn off "Restart from Checkpoint" button for the king
|
||||
RestartButton.interactable = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +117,29 @@ public class PauseMenu : NetworkBehaviour {
|
|||
}
|
||||
|
||||
[ServerRpc(RequireOwnership = false)]
|
||||
private void setPlayerControlsStateServerRPC(bool newState, ServerRpcParams serverRpcParams = default) {
|
||||
public void TurnOffPanelServerRPC(ServerRpcParams serverRpcParams = default) {
|
||||
ClientRpcParams clientRpcParams = new ClientRpcParams
|
||||
{
|
||||
Send = new ClientRpcSendParams
|
||||
{
|
||||
TargetClientIds = new ulong[] { serverRpcParams.Receive.SenderClientId }
|
||||
}
|
||||
};
|
||||
|
||||
TurnOffPanelClientRPC(clientRpcParams);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
private void TurnOffPanelClientRPC(ClientRpcParams clientRpcParams)
|
||||
{
|
||||
PauseMenuPanel.SetActive(false);
|
||||
ControlsPanel.SetActive(false);
|
||||
ConfirmationPanel.SetActive(false);
|
||||
RespawnConfirmationPanel.SetActive(false);
|
||||
}
|
||||
|
||||
[ServerRpc(RequireOwnership = false)]
|
||||
public void setPlayerControlsStateServerRPC(bool newState, ServerRpcParams serverRpcParams = default) {
|
||||
ClientRpcParams clientRpcParams = new ClientRpcParams
|
||||
{
|
||||
Send = new ClientRpcSendParams
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user