-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using UnityEngine.UI; | ||
|
||
public class Options : MonoBehaviour { | ||
public Text MusicVolumeText, SoundVolumeText; | ||
public Slider MusicSlider, SoundSlider; | ||
|
||
// Use this for initialization | ||
void Start () { | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update () { | ||
SoundController.MusicVolume = MusicSlider.value; | ||
SoundController.SoundVolume = SoundSlider.value; | ||
int v2 = (int)(SoundController.SoundVolume * 100); | ||
int v1 = (int)(SoundController.MusicVolume * 100); | ||
SoundVolumeText.text = "Sound Volume: " + (v2).ToString() + "%"; | ||
MusicVolumeText.text = "Music Volume: " + (v1).ToString() + "%"; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using UnityEngine.SceneManagement; | ||
|
||
public class SoundController : MonoBehaviour { | ||
public static float MusicVolume = 0.75f, SoundVolume = 0.75f; | ||
|
||
public static bool MusicIsMuted = false, SoundIsMuted = false; | ||
|
||
public AudioClip[] Music; | ||
public int CurrentSceneMusicTrack; | ||
|
||
private AudioSource MainMusicAudio; | ||
|
||
|
||
public static SoundController Instance; | ||
|
||
void Awake() | ||
{ | ||
if(Instance) | ||
DestroyImmediate(gameObject); | ||
else | ||
{ | ||
DontDestroyOnLoad(gameObject); | ||
Instance = this; | ||
} | ||
} | ||
|
||
|
||
void Start() | ||
{ | ||
MainMusicAudio = GetComponent<AudioSource>(); | ||
MainMusicAudio.Stop(); | ||
} | ||
void Update() | ||
{ | ||
if (CurrentSceneMusicTrack != Application.loadedLevel) { MainMusicAudio.Stop(); | ||
CurrentSceneMusicTrack = Application.loadedLevel; | ||
} | ||
if (MusicIsMuted) MainMusicAudio.mute = true; | ||
else MainMusicAudio.mute = false; | ||
|
||
|
||
MainMusicAudio.volume = MusicVolume; | ||
if (!MainMusicAudio.isPlaying) { | ||
MainMusicAudio.clip = Music[CurrentSceneMusicTrack]; | ||
MainMusicAudio.Play(); | ||
} | ||
} | ||
public void ToggleMusic() | ||
{ | ||
MusicIsMuted = !MusicIsMuted; | ||
} | ||
public void ToggleSound() | ||
{ | ||
SoundIsMuted = !SoundIsMuted; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using System; | ||
|
||
public class VolumeController : MonoBehaviour { | ||
private AudioSource AS; | ||
|
||
public enum MyEnumListy { Music, Sound} | ||
public MyEnumListy TypeOfAudio; | ||
|
||
void Start() | ||
{ | ||
AS = GetComponent<AudioSource>(); | ||
} | ||
void Update() | ||
{ | ||
switch (TypeOfAudio) | ||
{ | ||
case MyEnumListy.Music: | ||
AS.volume = SoundController.MusicVolume; | ||
break; | ||
case MyEnumListy.Sound: | ||
AS.volume = SoundController.SoundVolume; | ||
break; | ||
default: | ||
Debug.Log("NOTHING"); | ||
break; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using UnityEngine.UI; | ||
|
||
public class background : MonoBehaviour { | ||
|
||
|
||
Image bakgroundcolor; | ||
|
||
static float happynes; | ||
|
||
static float newColor = 1; | ||
|
||
|
||
public Color A = Color.white; | ||
public Color B; | ||
|
||
// Use this for initialization | ||
void Start () { | ||
|
||
bakgroundcolor = GetComponent<Image>(); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update () { | ||
|
||
newColor = GameMaster.LevelOfdepresion / 255; | ||
B = new Color(newColor, newColor, newColor, 1); | ||
newColor = GameMaster.LevelOfdepresion / 255; | ||
//print(newColor); | ||
bakgroundcolor.color = Color.Lerp(bakgroundcolor.color, B, Time.deltaTime * 0.5f); | ||
|
||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.