diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 1b7859c..f80f8db 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -1110,15 +1110,17 @@ MonoBehaviour: LCTRL - Slide/Slam - RMB - Sword + RMB - Sword Attack - TAB - Slow Motion + (toggle) TAB - Slow Motion F - Pickup/Throw + ESC/P + - Pause - Have - fun!' + + Have fun!' m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} @@ -1542,7 +1544,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: -200} + m_AnchoredPosition: {x: 0, y: -202} m_SizeDelta: {x: 160, y: 20} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &332973131 @@ -3834,10 +3836,10 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: - - m_Target: {fileID: 1611141924} - m_TargetAssemblyTypeName: UnityEngine.GameObject, UnityEngine - m_MethodName: SetActive - m_Mode: 6 + - m_Target: {fileID: 1124947465} + m_TargetAssemblyTypeName: Pause, Assembly-CSharp + m_MethodName: TogglePause + m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine @@ -5158,6 +5160,83 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1062675662} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &1065132565 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1065132566} + - component: {fileID: 1065132568} + - component: {fileID: 1065132567} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1065132566 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1065132565} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 2079348504} + m_Father: {fileID: 1175067549} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -10} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1065132567 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1065132565} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1065132568 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1065132565} + m_CullTransparentMesh: 1 --- !u!1 &1066673259 GameObject: m_ObjectHideFlags: 0 @@ -5184,7 +5263,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1066673259} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} m_ConstrainProportionsScale: 0 @@ -5198,7 +5277,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 120} + m_AnchoredPosition: {x: 0, y: 118} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1066673261 @@ -5625,6 +5704,7 @@ GameObject: - component: {fileID: 1124947461} - component: {fileID: 1124947460} - component: {fileID: 1124947464} + - component: {fileID: 1124947465} m_Layer: 5 m_Name: Canvas m_TagString: Untagged @@ -5731,12 +5811,24 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: vSyncToggle: {fileID: 332973131} + fullScreenToggle: {fileID: 1175067550} maxFPSSlider: {fileID: 1147868652} maxFPSText: {fileID: 174632477} qualityDropdown: {fileID: 1066673261} resolutionDropdown: {fileID: 1255291327} - fullScreenMode: 1 - SettingsPanel: {fileID: 1611141924} +--- !u!114 &1124947465 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1124947459} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bd99ff9df2c3b85489615428b8b5b458, type: 3} + m_Name: + m_EditorClassIdentifier: + pauseMenu: {fileID: 1611141924} --- !u!4 &1127913967 stripped Transform: m_CorrespondingSourceObject: {fileID: 3663668822022932514, guid: f2cfd694f3c29e84db23cdcaf1a2c3c8, type: 3} @@ -5873,11 +5965,11 @@ RectTransform: - {fileID: 314078513} - {fileID: 1771448632} m_Father: {fileID: 1945910483} - m_RootOrder: 1 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: -120} + m_AnchoredPosition: {x: 0, y: -122} m_SizeDelta: {x: 160, y: 20} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1147868652 @@ -5931,6 +6023,93 @@ MonoBehaviour: m_OnValueChanged: m_PersistentCalls: m_Calls: [] +--- !u!1 &1175067548 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1175067549} + - component: {fileID: 1175067550} + m_Layer: 5 + m_Name: FullScreen + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1175067549 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1175067548} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1065132566} + - {fileID: 1322810045} + m_Father: {fileID: 1945910483} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: -282} + m_SizeDelta: {x: 160, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1175067550 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1175067548} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1065132567} + toggleTransition: 1 + graphic: {fileID: 2079348505} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 --- !u!1 &1193866015 GameObject: m_ObjectHideFlags: 0 @@ -6371,7 +6550,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1255291325} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1.5, y: 1.5, z: 1.5} m_ConstrainProportionsScale: 0 @@ -6381,11 +6560,11 @@ RectTransform: - {fileID: 1210518675} - {fileID: 1053413786} m_Father: {fileID: 1945910483} - m_RootOrder: 2 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: -2} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1255291327 @@ -6486,6 +6665,143 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1255291325} m_CullTransparentMesh: 1 +--- !u!1 &1322810044 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1322810045} + - component: {fileID: 1322810047} + - component: {fileID: 1322810046} + m_Layer: 5 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1322810045 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1322810044} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1175067549} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 15, y: 0} + m_SizeDelta: {x: 130, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1322810046 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1322810044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: 'FullScreen + +' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: c9e8882d80f0ab64f87b7f2dd997f8b3, type: 2} + m_sharedMaterial: {fileID: -1314896432748127591, guid: c9e8882d80f0ab64f87b7f2dd997f8b3, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 15 + m_fontSizeBase: 15 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &1322810047 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1322810044} + m_CullTransparentMesh: 1 --- !u!1 &1323150173 GameObject: m_ObjectHideFlags: 0 @@ -7653,7 +7969,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0.11372549, g: 0.11372549, b: 0.11372549, a: 1} + m_Color: {r: 0.11372549, g: 0.11372549, b: 0.11372549, a: 0.99607843} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -7878,7 +8194,7 @@ RectTransform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1653874409} m_LocalRotation: {x: -0.12940949, y: 0.8365164, z: 0.22414386, w: 0.48296288} - m_LocalPosition: {x: 0, y: 0, z: -12.35} + m_LocalPosition: {x: 0, y: 0, z: -13.56} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -7889,7 +8205,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 18.05, y: 13.77} - m_SizeDelta: {x: 10, y: 10} + m_SizeDelta: {x: 12, y: 12} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1668495498 GameObject: @@ -8838,9 +9154,10 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1066673260} - - {fileID: 1147868651} - {fileID: 1255291326} + - {fileID: 1147868651} - {fileID: 332973130} + - {fileID: 1175067549} m_Father: {fileID: 1611141925} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -9276,6 +9593,82 @@ MonoBehaviour: m_EditorClassIdentifier: m_Weight: 1 m_Effectors: [] +--- !u!1 &2079348503 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2079348504} + - component: {fileID: 2079348506} + - component: {fileID: 2079348505} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2079348504 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2079348503} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1065132566} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 20, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2079348505 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2079348503} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10901, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &2079348506 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2079348503} + m_CullTransparentMesh: 1 --- !u!4 &32970192777918285 Transform: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Pause.cs b/Assets/Scripts/Pause.cs new file mode 100644 index 0000000..ea7316e --- /dev/null +++ b/Assets/Scripts/Pause.cs @@ -0,0 +1,38 @@ +using UnityEngine; + +public class Pause : MonoBehaviour +{ + public GameObject pauseMenu; + + private float previousTimeScale; + + public static bool isPaused = false; + + void Start() => previousTimeScale = Time.timeScale; + + void Update() + { + if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.P)) TogglePause(); + } + + public void TogglePause() + { + if (Time.timeScale > 0) + { + previousTimeScale = Time.timeScale; + Time.timeScale = 0; + AudioListener.pause = true; // for audio whenever that gets added + pauseMenu.SetActive(true); + + isPaused = true; + } + else if (Time.timeScale == 0) + { + Time.timeScale = previousTimeScale; + AudioListener.pause = false; // for audio whenever that gets added + pauseMenu.SetActive(false); + + isPaused = false; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Pause.cs.meta b/Assets/Scripts/Pause.cs.meta new file mode 100644 index 0000000..c73635f --- /dev/null +++ b/Assets/Scripts/Pause.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bd99ff9df2c3b85489615428b8b5b458 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Settings.cs b/Assets/Scripts/Settings.cs index 4900d60..1785df3 100644 --- a/Assets/Scripts/Settings.cs +++ b/Assets/Scripts/Settings.cs @@ -1,23 +1,26 @@ using UnityEngine; using TMPro; using UnityEngine.UI; +using System; public class Settings : MonoBehaviour { [Header("General UI")] public Toggle vSyncToggle; + public Toggle fullScreenToggle; public Slider maxFPSSlider; public TMP_Text maxFPSText; public TMP_Dropdown qualityDropdown; public TMP_Dropdown resolutionDropdown; - public FullScreenMode fullScreenMode = FullScreenMode.FullScreenWindow; - public GameObject SettingsPanel; + + private FullScreenMode fullScreenMode = FullScreenMode.FullScreenWindow; private void Awake() { LoadSettings(); vSyncToggle.onValueChanged.AddListener(ToggleVSync); + fullScreenToggle.onValueChanged.AddListener(ToggleFullScreen); maxFPSSlider.onValueChanged.AddListener(SetMaxFPS); qualityDropdown.onValueChanged.AddListener(SetQuality); resolutionDropdown.onValueChanged.AddListener(SetResolution); @@ -26,16 +29,6 @@ private void Awake() SetupResolutionDropdown(); } - void Update() - { - if (Input.GetKeyDown(KeyCode.Escape)) - { - SettingsManager sm = SettingsManager.Instance; - sm.SetPauseState(!sm.GetPauseState()); - SettingsPanel.SetActive(sm.GetPauseState()); - } - } - private void SetupResolutionDropdown() { resolutionDropdown.ClearOptions(); @@ -68,6 +61,10 @@ private void LoadSettings() vSyncToggle.isOn = vSyncOn; QualitySettings.vSyncCount = vSyncOn ? 1 : 0; + bool fullscreen = PlayerPrefs.GetString("Fullscreen", "FullScreenWindow") == "FullScreenWindow"; + fullScreenToggle.isOn = fullscreen; + Screen.SetResolution(Screen.width, Screen.height, fullscreen ? FullScreenMode.FullScreenWindow : FullScreenMode.Windowed); + float maxFPS = PlayerPrefs.GetFloat("MaxFPS", 60f); maxFPSSlider.value = maxFPS; Application.targetFrameRate = (int)maxFPS; @@ -80,6 +77,14 @@ private void LoadSettings() SetQuality(qualityIndex); } + private void ToggleFullScreen(bool isOn) + { + fullScreenMode = isOn ? FullScreenMode.FullScreenWindow : FullScreenMode.Windowed; + Screen.SetResolution(Screen.width, Screen.height, fullScreenMode); + PlayerPrefs.SetString("Fullscreen", isOn ? "FullScreenWindow" : "Windowed"); + PlayerPrefs.Save(); + } + private void ToggleVSync(bool isOn) { QualitySettings.vSyncCount = isOn ? 1 : 0; diff --git a/Assets/Scripts/SettingsManager.cs b/Assets/Scripts/SettingsManager.cs index 1185137..d540af6 100644 --- a/Assets/Scripts/SettingsManager.cs +++ b/Assets/Scripts/SettingsManager.cs @@ -4,8 +4,6 @@ public class SettingsManager : MonoBehaviour { public static SettingsManager Instance { get; private set; } - private static bool IsPaused = false; - void Awake() { if (Instance != null && Instance != this) Destroy(this); @@ -30,6 +28,10 @@ private void LoadSettings() bool vSyncOn = PlayerPrefs.GetInt("VSync", 1) == 1; QualitySettings.vSyncCount = vSyncOn ? 1 : 0; + // Fullscreen + bool fullscreen = PlayerPrefs.GetString("Fullscreen", "FullScreenWindow") == "FullScreenWindow"; + Screen.SetResolution(Screen.width, Screen.height, fullscreen ? FullScreenMode.FullScreenWindow : FullScreenMode.Windowed); + // Max FPS float maxFPS = PlayerPrefs.GetFloat("MaxFPS", 60f); Application.targetFrameRate = (int)maxFPS; @@ -46,10 +48,7 @@ private void LoadSettings() private void UpdateCursorVisibility() { - Cursor.visible = IsPaused; - Cursor.lockState = IsPaused ? CursorLockMode.None : CursorLockMode.Locked; + Cursor.visible = Pause.isPaused; + Cursor.lockState = Pause.isPaused ? CursorLockMode.None : CursorLockMode.Locked; } - - public void SetPauseState(bool paused) => IsPaused = paused; - public bool GetPauseState() => IsPaused; } \ No newline at end of file diff --git a/Assets/Scripts/SlowDownTime.cs b/Assets/Scripts/SlowDownTime.cs index 58893d4..ed1baeb 100644 --- a/Assets/Scripts/SlowDownTime.cs +++ b/Assets/Scripts/SlowDownTime.cs @@ -9,22 +9,26 @@ public class SlowDownTime : MonoBehaviour public Image bar; public Material slowMotionMaterial; - public bool isSlowMotion = false; + [HideInInspector] public bool isSlowMotion = false; + private float availableSlowdownTime; private float lastRechargeTime; + private float previousTimeScale; + void Start() => availableSlowdownTime = maxSlowdownTime; void Update() { - if (Input.GetKeyDown(KeyCode.Tab)) ToggleSlowMotion(); - if (isSlowMotion) + if (Input.GetKeyDown(KeyCode.Tab) && !Pause.isPaused) ToggleSlowMotion(); + if (isSlowMotion && !Pause.isPaused) { - availableSlowdownTime -= Time.unscaledDeltaTime; + availableSlowdownTime -= Time.deltaTime; if (availableSlowdownTime <= 0) ToggleSlowMotion(); } - else RechargeSlowdownTime(); + else if (!Pause.isPaused) RechargeSlowdownTime(); UpdateUI(); + HandleGamePaused(); } void RechargeSlowdownTime() @@ -52,5 +56,10 @@ void ToggleSlowMotion() } } + void HandleGamePaused() + { + if (Pause.isPaused && isSlowMotion) Time.timeScale = 0f; + } + void UpdateUI() => bar.fillAmount = availableSlowdownTime / maxSlowdownTime; } \ No newline at end of file