Added pause menu
Pause menu with settings
This commit is contained in:
70
3D FPS/Assets/MainMixer.mixer
Normal file
70
3D FPS/Assets/MainMixer.mixer
Normal file
@@ -0,0 +1,70 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!241 &24100000
|
||||
AudioMixerController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: MainMixer
|
||||
m_OutputGroup: {fileID: 0}
|
||||
m_MasterGroup: {fileID: 24300002}
|
||||
m_Snapshots:
|
||||
- {fileID: 24500006}
|
||||
m_StartSnapshot: {fileID: 24500006}
|
||||
m_SuspendThreshold: -80
|
||||
m_EnableSuspend: 1
|
||||
m_UpdateMode: 0
|
||||
m_ExposedParameters:
|
||||
- guid: 235ee0e28e7bda748ac8e08eed0b5116
|
||||
name: Volume
|
||||
m_AudioMixerGroupViews:
|
||||
- guids:
|
||||
- 168b7f83886edef4bbd10d8bf9ac3459
|
||||
name: View
|
||||
m_CurrentViewIndex: 0
|
||||
m_TargetSnapshot: {fileID: 24500006}
|
||||
--- !u!243 &24300002
|
||||
AudioMixerGroupController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Master
|
||||
m_AudioMixer: {fileID: 24100000}
|
||||
m_GroupID: 168b7f83886edef4bbd10d8bf9ac3459
|
||||
m_Children: []
|
||||
m_Volume: 235ee0e28e7bda748ac8e08eed0b5116
|
||||
m_Pitch: 3979cc489ab2d2945bbbc45d78835d56
|
||||
m_Send: 00000000000000000000000000000000
|
||||
m_Effects:
|
||||
- {fileID: 24400004}
|
||||
m_UserColorIndex: 0
|
||||
m_Mute: 0
|
||||
m_Solo: 0
|
||||
m_BypassEffects: 0
|
||||
--- !u!244 &24400004
|
||||
AudioMixerEffectController:
|
||||
m_ObjectHideFlags: 3
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_EffectID: d92766a96396d16478b863fe620c93cd
|
||||
m_EffectName: Attenuation
|
||||
m_MixLevel: 83f3784e0e3a19642b184cf370c5a412
|
||||
m_Parameters: []
|
||||
m_SendTarget: {fileID: 0}
|
||||
m_EnableWetMix: 0
|
||||
m_Bypass: 0
|
||||
--- !u!245 &24500006
|
||||
AudioMixerSnapshotController:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Snapshot
|
||||
m_AudioMixer: {fileID: 24100000}
|
||||
m_SnapshotID: 559d001a110185f499ec90086f2ea76f
|
||||
m_FloatValues: {}
|
||||
m_TransitionOverrides: {}
|
||||
8
3D FPS/Assets/MainMixer.mixer.meta
Normal file
8
3D FPS/Assets/MainMixer.mixer.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5be1589027b34c641af75ddcdcf84bf6
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 24100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@ public class GameOverScreen : MonoBehaviour
|
||||
{
|
||||
Time.timeScale = 1;
|
||||
SceneManager.LoadScene("SampleScene");
|
||||
}
|
||||
}
|
||||
|
||||
public void ExitButton()
|
||||
{
|
||||
|
||||
42
3D FPS/Assets/Scripts/PauseScreen.cs
Normal file
42
3D FPS/Assets/Scripts/PauseScreen.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class PauseScreen : MonoBehaviour
|
||||
{
|
||||
public GameObject pauseMenu;
|
||||
public GameObject settingsMenu;
|
||||
void Update()
|
||||
{
|
||||
if(Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Time.timeScale = 0;
|
||||
pauseMenu.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void RestartButtonn()
|
||||
{
|
||||
Time.timeScale = 1;
|
||||
SceneManager.LoadScene("SampleScene");
|
||||
}
|
||||
|
||||
public void ExitButtonn()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
public void ContinueButtonn()
|
||||
{
|
||||
Time.timeScale = 1;
|
||||
pauseMenu.SetActive(false);
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
|
||||
public void SettingButtonn()
|
||||
{
|
||||
settingsMenu.SetActive(true);
|
||||
}
|
||||
}
|
||||
11
3D FPS/Assets/Scripts/PauseScreen.cs.meta
Normal file
11
3D FPS/Assets/Scripts/PauseScreen.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 505700cfdc1c9a64d904be94a71e2781
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58
3D FPS/Assets/Scripts/SettingsMenu.cs
Normal file
58
3D FPS/Assets/Scripts/SettingsMenu.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SettingsMenu : MonoBehaviour
|
||||
{
|
||||
public AudioMixer audioMixer;
|
||||
|
||||
public TMP_Dropdown resolutionDropdown;
|
||||
|
||||
Resolution[] resolutions;
|
||||
int currentResolutionIndex;
|
||||
|
||||
void Start()
|
||||
{
|
||||
resolutions = Screen.resolutions;
|
||||
|
||||
resolutionDropdown.ClearOptions();
|
||||
List<string> options = new List<string>();
|
||||
|
||||
for (int i = 0; i < resolutions.Length; i++)
|
||||
{
|
||||
string option = resolutions[i].width + " x " + resolutions[i].height;
|
||||
options.Add(option);
|
||||
if(resolutions[i].width == Screen.width && resolutions[i].height == Screen.height) currentResolutionIndex = i;
|
||||
}
|
||||
resolutionDropdown.AddOptions(options);
|
||||
resolutionDropdown.value = currentResolutionIndex;
|
||||
resolutionDropdown.RefreshShownValue();
|
||||
}
|
||||
|
||||
public void ContinueButton()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void setVolume(float vol)
|
||||
{
|
||||
audioMixer.SetFloat("Volume", vol);
|
||||
}
|
||||
|
||||
public void setQuality(int qualityIndex)
|
||||
{
|
||||
QualitySettings.SetQualityLevel(qualityIndex);
|
||||
}
|
||||
|
||||
public void setFullscreen(bool isFullscreen)
|
||||
{
|
||||
Screen.fullScreen = isFullscreen;
|
||||
}
|
||||
public void setResolution(int resolutionIndex)
|
||||
{
|
||||
Screen.SetResolution(resolutions[resolutionIndex].width, resolutions[resolutionIndex].height, FullScreenMode.FullScreenWindow);
|
||||
}
|
||||
}
|
||||
11
3D FPS/Assets/Scripts/SettingsMenu.cs.meta
Normal file
11
3D FPS/Assets/Scripts/SettingsMenu.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc78eb88235f0d8488d07c05df94a479
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user