Shamba

Settings_menu

Dec 5th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Audio;
  5. using UnityEngine.UI;
  6.  
  7. public class settings_menu : MonoBehaviour {
  8.  
  9.     public AudioMixer master_mixer;
  10.  
  11.     public Text Button_txt;
  12.  
  13.     private int TapCount = 0;
  14.  
  15.     // Use this for initialization
  16.     void Start ()
  17.     {
  18.      
  19.     }
  20.    
  21.     // Update is called once per frame
  22.     void Update () {
  23.        
  24.     }
  25.  
  26.     //volume
  27.     public void Volume_Bar(float volume)
  28.     {
  29.         master_mixer.SetFloat("volume", volume);
  30.     }
  31.  
  32.     //Graphics Quality
  33.     public void Graphics_quality()
  34.     {
  35.         TapCount++;
  36.         if(TapCount == 4)
  37.         {
  38.             TapCount = 0;
  39.         }
  40.  
  41.         switch(TapCount)
  42.         {
  43.             case 0:
  44.                 Button_txt.text = "Low";
  45.                 QualitySettings.SetQualityLevel(0);
  46.                 break;
  47.             case 1:
  48.                 Button_txt.text = "Medium";
  49.                 QualitySettings.SetQualityLevel(1);
  50.                 break;
  51.             case 2:
  52.                 Button_txt.text = "High";
  53.                 QualitySettings.SetQualityLevel(2);
  54.                 break;
  55.             case 3:
  56.                 Button_txt.text = "Ultra";
  57.                 QualitySettings.SetQualityLevel(3);
  58.                 break;
  59.         }
  60.     }
  61.  
  62.     //Fullscreen Toggle
  63.     public void Fullscreen_toggle(bool isFullscreen)
  64.     {
  65.         Screen.fullScreen = isFullscreen;
  66.     }
  67. }
Add Comment
Please, Sign In to add comment