Menuing and stuff also sound or smtg but not joever
This commit is contained in:
parent
33467f6cc4
commit
b3a87fb2a6
14 changed files with 6294 additions and 26 deletions
34
Assets/Scripts/Buttons.cs
Normal file
34
Assets/Scripts/Buttons.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Buttons : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void PlayGame()
|
||||
{
|
||||
SceneManager.LoadSceneAsync("Start Scene");
|
||||
}
|
||||
|
||||
public void LaunchSettings()
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
GameObject.Find("Options").SetActive(true);
|
||||
}
|
||||
|
||||
public void QuitGame()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
}
|
2
Assets/Scripts/Buttons.cs.meta
Normal file
2
Assets/Scripts/Buttons.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2631588099c5db345935a689937fbf54
|
51
Assets/Scripts/OptionSettings.cs
Normal file
51
Assets/Scripts/OptionSettings.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class OptionSettings : MonoBehaviour
|
||||
{
|
||||
Resolution[] res;
|
||||
public TMP_Dropdown resDropdown;
|
||||
|
||||
void Start()
|
||||
{
|
||||
res = Screen.resolutions;
|
||||
resDropdown.ClearOptions();
|
||||
List<string> resOp = new List<string>();
|
||||
|
||||
int currentRes=0;
|
||||
for (int i = 0; i < res.Length; i++)
|
||||
{
|
||||
string op = res[i].width + " x " + res[i].height;
|
||||
resOp.Add(op);
|
||||
|
||||
if (res[i].width == Screen.currentResolution.width && res[i].height==Screen.currentResolution.height)
|
||||
{
|
||||
currentRes = i;
|
||||
}
|
||||
}
|
||||
|
||||
resDropdown.AddOptions(resOp);
|
||||
resDropdown.value = currentRes;
|
||||
resDropdown.RefreshShownValue();
|
||||
}
|
||||
|
||||
public void CloseMenu()
|
||||
{
|
||||
this.gameObject.SetActive(false);
|
||||
GameObject.Find("Main").SetActive(true);
|
||||
}
|
||||
|
||||
public void ChangeQuality(int qindex)
|
||||
{
|
||||
QualitySettings.SetQualityLevel(qindex);
|
||||
}
|
||||
|
||||
public void ChangeResolution(int resIndex)
|
||||
{
|
||||
Resolution res = Screen.resolutions[resIndex];
|
||||
Screen.SetResolution(res.width, res.height, Screen.fullScreen);
|
||||
}
|
||||
}
|
2
Assets/Scripts/OptionSettings.cs.meta
Normal file
2
Assets/Scripts/OptionSettings.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f74a2b991b2762e4591e35051c9faf37
|
36
Assets/Scripts/SoundSettings.cs
Normal file
36
Assets/Scripts/SoundSettings.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SoundSettings : MonoBehaviour
|
||||
{
|
||||
[HideInInspector] public AudioSource source;
|
||||
public AudioClip clip;
|
||||
public string clipname;
|
||||
public bool isLoop;
|
||||
public bool playOnAwake;
|
||||
|
||||
[SerializeField] Slider slider;
|
||||
[SerializeField] AudioMixer audioMixer;
|
||||
|
||||
public void SetVolume(float value)
|
||||
{
|
||||
if (value < 1)
|
||||
{
|
||||
value = 0.01f;
|
||||
}
|
||||
RefreshSlider(value);
|
||||
PlayerPrefs.SetFloat("Saved Maseter Volume", value);
|
||||
audioMixer.SetFloat("Master Volume", Mathf.Log10(value / 100) * 20f);
|
||||
}
|
||||
|
||||
public void SetVolumeFromSlider()
|
||||
{
|
||||
SetVolume(slider.value);
|
||||
}
|
||||
|
||||
public void RefreshSlider(float value)
|
||||
{
|
||||
slider.value = value;
|
||||
}
|
||||
}
|
2
Assets/Scripts/SoundSettings.cs.meta
Normal file
2
Assets/Scripts/SoundSettings.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9a0f3715a065b894f9a1375cdc28fe8e
|
Loading…
Add table
Add a link
Reference in a new issue