-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacters.cs
113 lines (91 loc) · 2.48 KB
/
Characters.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Characters : MonoBehaviour
{
private GameObject Butref;
private Image im;
private Color myColor;
private Image ImVol;
private float vol = 0;
private Slider mySlider;
void Start()
{
mySlider = FindObjectOfType<Slider>();
mySlider.maxValue = 3;
if (PlayerPrefsManager.GetVolume() == 0f)
{
mySlider.value = 0;
}
if (PlayerPrefsManager.GetVolume() == 0.2f)
{
mySlider.value = 1;
}
if (PlayerPrefsManager.GetVolume() == 0.465f)
{
mySlider.value = 2;
}
if (PlayerPrefsManager.GetVolume() == 0.87f)
{
mySlider.value = 3;
}
}
public void Character0()
{
PlayerPrefsManager.SetCharacter(0);
Butref = GameObject.Find("Button0");
im = Butref.GetComponent<Image>();
myColor = im.color;
myColor.a = 1f;
im.color = myColor;
}
public void Character1()
{
PlayerPrefsManager.SetCharacter(1);
Butref = GameObject.Find("Button1");
im = Butref.GetComponent<Image>();
myColor = im.color;
myColor.a = 1f;
im.color = myColor;
}
void Update()
{
vol = mySlider.value;
ImVol = mySlider.GetComponentInChildren<Image>();
if (vol == 0)
{
ImVol.fillAmount = 0f;
}
else if (vol == 1)
{
ImVol.fillAmount = 0.2f;
}
else if (vol == 2)
{
ImVol.fillAmount = 0.465f;
}
else if (vol == 3)
{
ImVol.fillAmount = 0.87f;
}
PlayerPrefsManager.SetVolume(ImVol.fillAmount);
if (PlayerPrefsManager.GetCharacter() != 0)
{
Butref = GameObject.Find("Button0");
im = Butref.GetComponent<Image>();
myColor = im.color;
myColor.a = 0.5f;
im.color = myColor;
}
if (PlayerPrefsManager.GetCharacter() != 1)
{
Butref = GameObject.Find("Button1");
im = Butref.GetComponent<Image>();
myColor = im.color;
myColor.a = 0.5f;
im.color = myColor;
}
}
}