Added pausing across all scenes and fixed any noticable bugs caused by pausing
This commit is contained in:
@@ -0,0 +1,116 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!74 &7400000
|
||||||
|
AnimationClip:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: PauseMenu
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Legacy: 0
|
||||||
|
m_Compressed: 0
|
||||||
|
m_UseHighQualityCurve: 1
|
||||||
|
m_RotationCurves: []
|
||||||
|
m_CompressedRotationCurves: []
|
||||||
|
m_EulerCurves: []
|
||||||
|
m_PositionCurves: []
|
||||||
|
m_ScaleCurves: []
|
||||||
|
m_FloatCurves:
|
||||||
|
- curve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 136
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0.5
|
||||||
|
value: 0.392
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 136
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
attribute: m_Color.a
|
||||||
|
path:
|
||||||
|
classID: 114
|
||||||
|
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||||
|
m_PPtrCurves: []
|
||||||
|
m_SampleRate: 60
|
||||||
|
m_WrapMode: 0
|
||||||
|
m_Bounds:
|
||||||
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
m_Extent: {x: 0, y: 0, z: 0}
|
||||||
|
m_ClipBindingConstant:
|
||||||
|
genericBindings:
|
||||||
|
- serializedVersion: 2
|
||||||
|
path: 0
|
||||||
|
attribute: 304273561
|
||||||
|
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||||
|
typeID: 114
|
||||||
|
customType: 0
|
||||||
|
isPPtrCurve: 0
|
||||||
|
pptrCurveMapping: []
|
||||||
|
m_AnimationClipSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||||
|
m_AdditiveReferencePoseTime: 0
|
||||||
|
m_StartTime: 0
|
||||||
|
m_StopTime: 0.5
|
||||||
|
m_OrientationOffsetY: 0
|
||||||
|
m_Level: 0
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_HasAdditiveReferencePose: 0
|
||||||
|
m_LoopTime: 0
|
||||||
|
m_LoopBlend: 0
|
||||||
|
m_LoopBlendOrientation: 0
|
||||||
|
m_LoopBlendPositionY: 0
|
||||||
|
m_LoopBlendPositionXZ: 0
|
||||||
|
m_KeepOriginalOrientation: 0
|
||||||
|
m_KeepOriginalPositionY: 1
|
||||||
|
m_KeepOriginalPositionXZ: 0
|
||||||
|
m_HeightFromFeet: 0
|
||||||
|
m_Mirror: 0
|
||||||
|
m_EditorCurves:
|
||||||
|
- curve:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Curve:
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0
|
||||||
|
value: 0
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 136
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
- serializedVersion: 3
|
||||||
|
time: 0.5
|
||||||
|
value: 0.392
|
||||||
|
inSlope: 0
|
||||||
|
outSlope: 0
|
||||||
|
tangentMode: 136
|
||||||
|
weightedMode: 0
|
||||||
|
inWeight: 0.33333334
|
||||||
|
outWeight: 0.33333334
|
||||||
|
m_PreInfinity: 2
|
||||||
|
m_PostInfinity: 2
|
||||||
|
m_RotationOrder: 4
|
||||||
|
attribute: m_Color.a
|
||||||
|
path:
|
||||||
|
classID: 114
|
||||||
|
script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||||
|
m_EulerEditorCurves: []
|
||||||
|
m_HasGenericRootTransform: 0
|
||||||
|
m_HasMotionFloatCurves: 0
|
||||||
|
m_Events: []
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9c2a1dd132a426646a793568f10cf32e
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1107 &-7761923135276731317
|
||||||
|
AnimatorStateMachine:
|
||||||
|
serializedVersion: 5
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: Base Layer
|
||||||
|
m_ChildStates:
|
||||||
|
- serializedVersion: 1
|
||||||
|
m_State: {fileID: -1103415635566709068}
|
||||||
|
m_Position: {x: 200, y: 0, z: 0}
|
||||||
|
m_ChildStateMachines: []
|
||||||
|
m_AnyStateTransitions: []
|
||||||
|
m_EntryTransitions: []
|
||||||
|
m_StateMachineTransitions: {}
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||||
|
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||||
|
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||||
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
|
m_DefaultState: {fileID: -1103415635566709068}
|
||||||
|
--- !u!1102 &-1103415635566709068
|
||||||
|
AnimatorState:
|
||||||
|
serializedVersion: 5
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: PauseMenu
|
||||||
|
m_Speed: 1
|
||||||
|
m_CycleOffset: 0
|
||||||
|
m_Transitions: []
|
||||||
|
m_StateMachineBehaviours: []
|
||||||
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
|
m_IKOnFeet: 0
|
||||||
|
m_WriteDefaultValues: 1
|
||||||
|
m_Mirror: 0
|
||||||
|
m_SpeedParameterActive: 0
|
||||||
|
m_MirrorParameterActive: 0
|
||||||
|
m_CycleOffsetParameterActive: 0
|
||||||
|
m_TimeParameterActive: 0
|
||||||
|
m_Motion: {fileID: 7400000, guid: 9c2a1dd132a426646a793568f10cf32e, type: 2}
|
||||||
|
m_Tag:
|
||||||
|
m_SpeedParameter:
|
||||||
|
m_MirrorParameter:
|
||||||
|
m_CycleOffsetParameter:
|
||||||
|
m_TimeParameter:
|
||||||
|
--- !u!91 &9100000
|
||||||
|
AnimatorController:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name: PauseMenu
|
||||||
|
serializedVersion: 5
|
||||||
|
m_AnimatorParameters: []
|
||||||
|
m_AnimatorLayers:
|
||||||
|
- serializedVersion: 5
|
||||||
|
m_Name: Base Layer
|
||||||
|
m_StateMachine: {fileID: -7761923135276731317}
|
||||||
|
m_Mask: {fileID: 0}
|
||||||
|
m_Motions: []
|
||||||
|
m_Behaviours: []
|
||||||
|
m_BlendingMode: 0
|
||||||
|
m_SyncedLayerIndex: -1
|
||||||
|
m_DefaultWeight: 0
|
||||||
|
m_IKPass: 0
|
||||||
|
m_SyncedLayerAffectsTiming: 0
|
||||||
|
m_Controller: {fileID: 9100000}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 69d8fd04df683e248ae908b481bb75f4
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
public class CameraController : MonoBehaviour
|
public class CameraController : MonoBehaviour
|
||||||
{
|
{
|
||||||
@@ -21,15 +22,21 @@ public class CameraController : MonoBehaviour
|
|||||||
pivot.position = player.position;
|
pivot.position = player.position;
|
||||||
pivot.parent = null;
|
pivot.parent = null;
|
||||||
|
|
||||||
Cursor.visible = !Cursor.visible;
|
|
||||||
Cursor.lockState = CursorLockMode.Locked;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LateUpdate(){
|
void LateUpdate(){
|
||||||
float camX = Input.GetAxisRaw("Mouse X") * rotateSpeed;
|
|
||||||
|
float camX = 0;
|
||||||
|
float camY = 0;
|
||||||
|
|
||||||
|
if(!PauseMenu.GameIsPaused)
|
||||||
|
{
|
||||||
|
camX = Input.GetAxisRaw("Mouse X") * rotateSpeed;
|
||||||
|
camY = Input.GetAxisRaw("Mouse Y") * rotateSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
pivot.Rotate(0, camX, 0);
|
pivot.Rotate(0, camX, 0);
|
||||||
|
|
||||||
float camY = Input.GetAxisRaw("Mouse Y") * rotateSpeed;
|
|
||||||
if (invertY){
|
if (invertY){
|
||||||
pivot.Rotate(camY, 0, 0);
|
pivot.Rotate(camY, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
public class PauseMenu : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
public static bool GameIsPaused = false;
|
||||||
|
|
||||||
|
public GameObject pauseMenuUI;
|
||||||
|
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(Input.GetButtonDown("Pause"))
|
||||||
|
{
|
||||||
|
if(GameIsPaused)
|
||||||
|
{
|
||||||
|
Resume();
|
||||||
|
Cursor.visible = !Cursor.visible;
|
||||||
|
Cursor.lockState = CursorLockMode.Locked;
|
||||||
|
} else {
|
||||||
|
Pause();
|
||||||
|
Cursor.visible = Cursor.visible;
|
||||||
|
Cursor.lockState = CursorLockMode.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Resume()
|
||||||
|
{
|
||||||
|
pauseMenuUI.SetActive(false);
|
||||||
|
Time.timeScale = 1f;
|
||||||
|
GameIsPaused = false;
|
||||||
|
Cursor.visible = !Cursor.visible;
|
||||||
|
Cursor.lockState = CursorLockMode.Locked;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Pause()
|
||||||
|
{
|
||||||
|
pauseMenuUI.SetActive(true);
|
||||||
|
Time.timeScale = 0f;
|
||||||
|
GameIsPaused = true;
|
||||||
|
Cursor.visible = Cursor.visible;
|
||||||
|
Cursor.lockState = CursorLockMode.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadHubWorld()
|
||||||
|
{
|
||||||
|
Time.timeScale = 1f;
|
||||||
|
GameIsPaused = false;
|
||||||
|
SceneManager.LoadScene("Hub World", LoadSceneMode.Single);
|
||||||
|
Cursor.visible = !Cursor.visible;
|
||||||
|
Cursor.lockState = CursorLockMode.Locked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadMenu()
|
||||||
|
{
|
||||||
|
Time.timeScale = 1f;
|
||||||
|
GameIsPaused = false;
|
||||||
|
SceneManager.LoadScene("Main Menu", LoadSceneMode.Single);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Quit()
|
||||||
|
{
|
||||||
|
|
||||||
|
Application.Quit();
|
||||||
|
Debug.Log("QUIT");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0c6b30107c3524640ba48d3bc77c7126
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -60,6 +60,9 @@ public class PlayerController : MonoBehaviour
|
|||||||
capsuleHeight = capsule.height;
|
capsuleHeight = capsule.height;
|
||||||
maxSpeedStore = maxSpeed;
|
maxSpeedStore = maxSpeed;
|
||||||
accelerationStore = acceleration;
|
accelerationStore = acceleration;
|
||||||
|
|
||||||
|
Cursor.visible = !Cursor.visible;
|
||||||
|
Cursor.lockState = CursorLockMode.Locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnControllerColliderHit(ControllerColliderHit hit)
|
void OnControllerColliderHit(ControllerColliderHit hit)
|
||||||
@@ -160,7 +163,7 @@ public class PlayerController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Input.GetButton("Crouch") || Input.GetAxis("Crouch") == 1.0f)
|
if((Input.GetButton("Crouch") || Input.GetAxis("Crouch") == 1.0f) && !PauseMenu.GameIsPaused)
|
||||||
{
|
{
|
||||||
|
|
||||||
characterController.height /= 2;
|
characterController.height /= 2;
|
||||||
@@ -209,7 +212,7 @@ public class PlayerController : MonoBehaviour
|
|||||||
} else {
|
} else {
|
||||||
slideTime = Time.time;
|
slideTime = Time.time;
|
||||||
|
|
||||||
if(Input.GetButton("Crouch") || Input.GetAxis("Crouch") == 1.0f)
|
if((Input.GetButton("Crouch") || Input.GetAxis("Crouch") == 1.0f) && !PauseMenu.GameIsPaused)
|
||||||
{
|
{
|
||||||
|
|
||||||
characterController.height /= 2;
|
characterController.height /= 2;
|
||||||
|
|||||||
+172
-38
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user