mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-09-08 10:25:16 -05:00
Merge branch 'ResetButton'
This commit is contained in:
@@ -16,6 +16,9 @@ public class PauseMenu : MonoBehaviour {
|
||||
[SerializeField]
|
||||
private GameObject ConfirmationPanel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject RespawnConfirmationPanel;
|
||||
|
||||
[SerializeField]
|
||||
private TMP_Text ControlsHeader;
|
||||
[SerializeField]
|
||||
@@ -29,6 +32,7 @@ public class PauseMenu : MonoBehaviour {
|
||||
PauseMenuPanel.SetActive(false);
|
||||
ControlsPanel.SetActive(false);
|
||||
ConfirmationPanel.SetActive(false);
|
||||
RespawnConfirmationPanel.SetActive(false);
|
||||
}
|
||||
|
||||
void Update() {
|
||||
@@ -127,4 +131,24 @@ public class PauseMenu : MonoBehaviour {
|
||||
ControlsText.text = "To-Do: Put the Runner's Controls here";
|
||||
}
|
||||
}
|
||||
|
||||
public void OnRespawnClicked() {
|
||||
RespawnConfirmationPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void RespawnDecline() {
|
||||
RespawnConfirmationPanel.SetActive(false);
|
||||
}
|
||||
|
||||
public void RespawnConfirmed() {
|
||||
// Disable/Enable player controls
|
||||
GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
|
||||
|
||||
foreach (GameObject player in players) {
|
||||
// Find the local player
|
||||
if (player.GetComponent<NetworkObject>().IsLocalPlayer) {
|
||||
player.GetComponent<ResetZones>().RespawnToCheckpoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user