Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Option : MonoBehaviour
- {
- private bool openoption = false;
- private bool showsoundslider = false;
- public float buttonWidth = 100;
- public float buttonHeight = 30;
- public float SoundEffect = 5.0f;
- private bool showgraphics = false;
- // Use this for initialization
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- //tu mam problem
- Antialiasing Ant = gameObject.GetComponentInParent<Antialiasing>();
- //tu mam problem
- // Zaczynamy Wyciszać dźwięki
- AudioSource As = gameObject.GetComponent<AudioSource>();
- if (SoundEffect < 5.0f)
- {
- As.volume = 0.8f;
- }
- else if (SoundEffect == 5.0f)
- {
- As.volume = 1.0f;
- }
- if (SoundEffect < 4.0f)
- {
- As.volume = 0.6f;
- }
- else if (SoundEffect == 4.0f)
- {
- As.volume = 0.8f;
- }
- if (SoundEffect < 3.0f)
- {
- As.volume = 0.4f;
- }
- else if (SoundEffect == 3.0f)
- {
- As.volume = 0.6f;
- }
- if (SoundEffect < 2.0f)
- {
- As.volume = 0.2f;
- }
- else if (SoundEffect == 2.0f)
- {
- As.volume = 0.4f;
- }
- if (SoundEffect < 1.0f)
- {
- As.volume = 0.0f;
- }
- else if (SoundEffect == 1.0f)
- {
- As.volume = 0.2f;
- }
- // Kończymy Wyciszać Dzwięki
- }
- void OnGUI()
- {
- if (GUI.Button(new Rect(50, 400, buttonWidth, buttonHeight), "Opcje"))
- {
- openoption = !openoption;
- }
- if (openoption)
- {
- if (GUI.Button(new Rect(700, 400, buttonWidth, buttonHeight), "Graficzne"))
- {
- showgraphics = !showgraphics;
- }
- if (GUI.Button(new Rect(400, 400, buttonWidth, buttonHeight), "Dzwięki"))
- {
- showsoundslider = !showsoundslider;
- }
- if (showsoundslider)
- {
- SoundEffect = GUI.VerticalSlider(new Rect(400, 500, 30, 100), SoundEffect, 5.0F, 0.0F);
- GUI.Label(new Rect(420, 490, 10, 160), "Muzyka");
- }
- if (showgraphics)
- {
- GUI.Label(new Rect(700, 460, 100, 50), "Jakość :");
- if (GUI.Button(new Rect(770, 460, 100, 30), "Niska"))
- {
- }
- if (GUI.Button(new Rect(870, 460, 100, 30), "Wysoka"))
- {
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement