private void OnPauseMenuClosed() { Cursor.lockState = CursorLockMode.Locked; PlayerMovement playerMovement = GetComponent <PlayerMovement>(); ThirdPersonCamera thirdPersonCamera = GetComponent <ThirdPersonCamera>(); Spellcasting spellcasting = GetComponent <Spellcasting>(); Dancing dancing = GetComponent <Dancing>(); if (playerMovement != null && !networkGamePlayerMageBall.IsFrozen) { playerMovement.enabled = true; } if (dancing != null) { dancing.enabled = true; } if (thirdPersonCamera != null) { thirdPersonCamera.enabled = true; } if (spellcasting != null && !networkGamePlayerMageBall.IsFrozen) { spellcasting.CmdSetCanCastSpells(true); } }
private IEnumerator ResetPlayer() { if (playerGameObject == null) { yield return(new WaitUntil(() => playerGameObject != null)); } PlayerMovement playerMovement = playerGameObject.GetComponent <PlayerMovement>(); playerMovement.ResetSpeed(); playerMovement.enabled = false; CharacterControllerGravity gravity = playerGameObject.GetComponent <CharacterControllerGravity>(); gravity.enabled = false; Spellcasting spellcasting = playerGameObject.GetComponent <Spellcasting>(); spellcasting.ResetMana(); spellcasting.CmdSetCanCastSpells(false); Animator animator = playerGameObject.GetComponent <Animator>(); if (animator != null) { animator.SetFloat("Speed", 0); animator.SetBool("IsJumping", false); } playerGameObject.transform.position = spawnPosition; playerGameObject.transform.rotation = spawnRotation; StartCoroutine(EnablePlayerControls()); }
private IEnumerator EnablePlayerControls() { isFrozen = true; yield return(new WaitForSeconds(NetworkManager.WaitBeforeControlsEnableInSeconds)); isFrozen = false; CharacterControllerGravity gravity = playerGameObject.GetComponent <CharacterControllerGravity>(); gravity.enabled = true; PauseMenu pauseMenu = FindObjectOfType <PauseMenu>(); if (pauseMenu != null && pauseMenu.IsOpen) { yield break; } PlayerMovement playerMovement = playerGameObject.GetComponent <PlayerMovement>(); playerMovement.enabled = true; Spellcasting spellcasting = playerGameObject.GetComponent <Spellcasting>(); spellcasting.CmdSetCanCastSpells(true); }
private void OnPauseMenuOpened() { Cursor.lockState = CursorLockMode.None; PlayerMovement playerMovement = GetComponent <PlayerMovement>(); ThirdPersonCamera thirdPersonCamera = GetComponent <ThirdPersonCamera>(); Spellcasting spellcasting = GetComponent <Spellcasting>(); Animator animator = GetComponent <Animator>(); Dancing dancing = GetComponent <Dancing>(); if (animator != null) { animator.SetFloat("Speed", 0); animator.SetBool("IsJumping", false); } if (playerMovement != null) { playerMovement.ResetSpeed(); playerMovement.enabled = false; } if (dancing != null) { dancing.enabled = false; dancing.StopDancing(); } if (thirdPersonCamera != null) { thirdPersonCamera.enabled = false; } if (spellcasting != null) { spellcasting.CmdSetCanCastSpells(false); } }