diff --git a/Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab b/Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab index 5a8b0c0..d0c5f42 100644 --- a/Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab +++ b/Assets/Prefabs/Player/NetworkSMPlayerPrefab.prefab @@ -5008,6 +5008,7 @@ MonoBehaviour: hasDash: 0 playerPoints: 15 isPaused: 0 + isRespawning: 1 windOn: 0 windDirection: {x: 0, y: 0, z: 0} --- !u!114 &7688428083034862284 diff --git a/Assets/Scenes/Demos/MovementScene.unity b/Assets/Scenes/Demos/MovementScene.unity index 4f487f9..82908d4 100644 --- a/Assets/Scenes/Demos/MovementScene.unity +++ b/Assets/Scenes/Demos/MovementScene.unity @@ -3629,6 +3629,10 @@ PrefabInstance: propertyPath: hasGrapple value: 1 objectReference: {fileID: 0} + - target: {fileID: 1707207228499037468, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} + propertyPath: isRespawning + value: 1 + objectReference: {fileID: 0} - target: {fileID: 5759777694531189237, guid: 0ea305f96ab853340bb9f0ed320dac08, type: 3} propertyPath: m_RootOrder value: 13 diff --git a/Assets/Scripts/Environment/Pitfall.cs b/Assets/Scripts/Environment/Pitfall.cs index 77bd611..675674a 100644 --- a/Assets/Scripts/Environment/Pitfall.cs +++ b/Assets/Scripts/Environment/Pitfall.cs @@ -18,6 +18,7 @@ public class Pitfall : NetworkBehaviour private void OnTriggerEnter(Collider other) { if (cooldown == false && other.transform.gameObject.tag == "PlayerTrigger" && other.gameObject.transform.root.gameObject.GetComponent().OwnerClientId == NetworkManager.Singleton.LocalClientId) { + other.transform.root.GetComponentInChildren().IsRespawning = true; RespawnPlayerServerRPC(other.gameObject.transform.root.gameObject.GetComponent().OwnerClientId); cooldown = true; StartCoroutine(CoolItDown()); @@ -135,6 +136,7 @@ public class Pitfall : NetworkBehaviour character.GetComponentInChildren().enabled = true; character.GetComponentInChildren().enabled = true; character.GetComponentInChildren().populatePlayerCanvas(); + character.GetComponentInChildren().IsRespawning = false; } } diff --git a/Assets/Scripts/Environment/SlowTerrain.cs b/Assets/Scripts/Environment/SlowTerrain.cs index 5eebc82..b533b4c 100644 --- a/Assets/Scripts/Environment/SlowTerrain.cs +++ b/Assets/Scripts/Environment/SlowTerrain.cs @@ -29,7 +29,7 @@ public class SlowTerrain : NetworkBehaviour foreach (GameObject player in players) { if (player.GetComponent().OwnerClientId == playerID) { - player.GetComponentInChildren().ApplySlimeBody(); + player.GetComponentInChildren().ApplySuperSlow(); } } } @@ -57,7 +57,7 @@ public class SlowTerrain : NetworkBehaviour foreach (GameObject player in players) { if (player.GetComponent().OwnerClientId == playerID) { - player.GetComponentInChildren().ClearSlimeBody(); + player.GetComponentInChildren().ClearSuperSlow(); } } } diff --git a/Assets/Scripts/Network/Game/SpawnManager.cs b/Assets/Scripts/Network/Game/SpawnManager.cs index 7374298..5f55517 100644 --- a/Assets/Scripts/Network/Game/SpawnManager.cs +++ b/Assets/Scripts/Network/Game/SpawnManager.cs @@ -40,7 +40,7 @@ public class SpawnManager : NetworkBehaviour { _runner.GetComponentInChildren().UpdateEquips(playerData.pInv.NetworkItemList, this.gameObject.GetComponent().ItemDict); _runner.GetComponentInChildren().populatePlayerCanvas(); _runner.GetComponent().SpawnAsPlayerObject(NetworkManager.Singleton.LocalClientId, null, true); - + _runner.GetComponentInChildren().IsRespawning = false; // Increment runners runnersSpawned++; } @@ -75,7 +75,7 @@ public class SpawnManager : NetworkBehaviour { // Spawn as player _runner = Instantiate(runnerPrefab, runnersSpawnPoints[runnersSpawned], Quaternion.Euler(0, -90, 0)).gameObject; _runner.GetComponent().SpawnAsPlayerObject(clientId, null, true); - + _runner.GetComponentInChildren().IsRespawning = false; // Increment runners runnersSpawned++; @@ -114,9 +114,9 @@ public class SpawnManager : NetworkBehaviour { // Find the local player if (character.GetComponent().OwnerClientId == clientID) { List itemList = itemsAsString.Split(',').ToList(); - character.GetComponentInChildren().UpdateEquips(itemList, this.gameObject.GetComponent().ItemDict); character.GetComponentInChildren().populatePlayerCanvas(); + } } } diff --git a/Assets/Scripts/PlayerScripts/PlayerStats.cs b/Assets/Scripts/PlayerScripts/PlayerStats.cs index c63572c..db7ed54 100644 --- a/Assets/Scripts/PlayerScripts/PlayerStats.cs +++ b/Assets/Scripts/PlayerScripts/PlayerStats.cs @@ -154,6 +154,12 @@ public class PlayerStats : MonoBehaviour set{ isPaused = value; } } + [SerializeField] private bool isRespawning = true; + public bool IsRespawning{ + get{ return isRespawning; } + set{ isRespawning = value; } + } + ////Weather Related stats //Is wind on [SerializeField] private bool windOn = false; @@ -283,13 +289,13 @@ public class PlayerStats : MonoBehaviour bool midWeatherOn; public void ApplySlimeBody(){ - maxVel *= .4f; + maxVel *= .5f; curVel = minVel; } //Clear slime body effect public void ClearSlimeBody(){ - maxVel *= (1/.4f); + maxVel *= (1/.5f); } //Apply slime trail effect to the player @@ -303,6 +309,21 @@ public class PlayerStats : MonoBehaviour traction *= (1 / .3f); curTraction *= (1 / .3f); } + + public void ApplySuperSlow(){ + minVel *=.2f; + maxVel *=.2f; + acc *= .2f; + + curVel = minVel; + } + + public void ClearSuperSlow(){ + minVel *= (1/.2f); + maxVel *= (1/.2f); + acc *= (1/.2f); + } + //// void Update(){ VariableValidation(); diff --git a/Assets/Scripts/UI/PauseMenu.cs b/Assets/Scripts/UI/PauseMenu.cs index d90998d..9b0a0f7 100644 --- a/Assets/Scripts/UI/PauseMenu.cs +++ b/Assets/Scripts/UI/PauseMenu.cs @@ -57,23 +57,39 @@ public class PauseMenu : NetworkBehaviour { // Listen for Pause button and not already paused // TODO: UPDATE TO ALSO LISTEN FOR CONTROLLER PAUSE BUTTON PRESSED if (isUsable && Input.GetKeyDown(KeyCode.Escape) && PauseMenuPanel.activeInHierarchy != true) { - // Display Pause Menu - PauseMenuPanel.SetActive(true); - isViewingRunnerControls = true; - - // Disable player controls - setPlayerControlsStateServerRPC(false); - - // Turn off "Restart from Checkpoint" button for the king GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); - foreach (GameObject player in players) { - // Make sure they are the local player - if (player.GetComponent().IsLocalPlayer) { + foreach(GameObject player in players){ + if(player.GetComponent().IsLocalPlayer){ + + if(player.GetComponent() == null){ + + if(!player.GetComponentInChildren().IsRespawning){ + // Display Pause Menu + PauseMenuPanel.SetActive(true); + isViewingRunnerControls = true; + + // Disable player controls + setPlayerControlsStateServerRPC(false); + } + } + // Check for king - if (player.GetComponent() != null) { + else{ + + // Display Pause Menu + PauseMenuPanel.SetActive(true); + isViewingRunnerControls = true; + + // Disable player controls + setPlayerControlsStateServerRPC(false); + + // Turn off "Restart from Checkpoint" button for the king RestartButton.interactable = false; } + + + } } } @@ -193,6 +209,8 @@ public class PauseMenu : NetworkBehaviour { } } + player.GetComponentInChildren().IsRespawning = true; + RespawnPlayerServerRPC(player.GetComponent().OwnerClientId, player.GetComponentInChildren().GetRespawnPosition(curZone)); } @@ -229,7 +247,6 @@ public class PauseMenu : NetworkBehaviour { // Handle Client Spawning Locally string itemsAsString = string.Join(",", playerData.pInv.NetworkItemList); - StartCoroutine(SpawnClient(clientID, itemsAsString)); } } @@ -291,6 +308,7 @@ public class PauseMenu : NetworkBehaviour { character.GetComponentInChildren().enabled = true; character.GetComponentInChildren().enabled = true; character.GetComponentInChildren().populatePlayerCanvas(); + character.GetComponentInChildren().IsRespawning = false; } } diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index e5df6c7..8e38c24 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -30,10 +30,10 @@ EditorUserSettings: value: 22424703114646680e0b0227036c7b151b180b650721283704240d14f0e12d3aedff78fce9332b25 flags: 0 RecentlyUsedScenePath-8: - value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb + value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26 flags: 0 RecentlyUsedScenePath-9: - value: 22424703114646680e0b0227036c7b151b180b6501273035202c1327d1e33136e7a923e7ee2e26 + value: 22424703114646680e0b0227036c6f02131b172b282d347e38271427fb flags: 0 vcSharedLogLevel: value: 0d5e400f0650