-
Notifications
You must be signed in to change notification settings - Fork 0
/
Controller.cs
119 lines (95 loc) · 2.75 KB
/
Controller.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
114
115
116
117
118
119
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Threading;
using UnityEngine.UI;
using UnityEngine.Events;
using System;
using System.IO;
using System.Diagnostics;
public class Controller : MonoBehaviour
{
public static Controller self;
public GameObject fon_timer;
public float chustitelnost;
public GameObject soundList;
public UnityAction postAct = null;
public List<GameObject> list_buttons;
public void SetIndex(int xz)
{
Direct.selflink.mem = xz;
RunTimer("restart");
// Restart.RestartGame();
}
public void RunTimer(string act, UnityAction Pact = null)
{
StartCoroutine(Timer(act));
postAct = Pact;
}
public IEnumerator Timer(string act)
{
fon_timer.gameObject.SetActive(true);
GetComponent<RayCast>().Some[3].SetActive(false);
int i = 3;
while (i > 0)
{
fon_timer.GetComponentInChildren<Text>().text = i + "";
yield return new WaitForSeconds(1f);
i--;
}
fon_timer.gameObject.SetActive(false);
if (act == "restart") Restart.RestartGame();
if (act == "next_level") MelodyPlayer.self.IncMus();
if (postAct != null) postAct();
}
void Awake()
{
self = this;
chustitelnost = 0.5f;
}
// Use this for initialization
void Start()
{
}
public void ValListButtion()
{
for (int i = 0; i < list_buttons.ToArray().Length; i++)
{
try
{
if (i < Direct.selflink.clipIms.ToArray().Length) list_buttons[i].SetActive(true);
list_buttons[i].GetComponentInChildren<Text>().text = Direct.selflink.clipIms[i].clip.name;
}
catch { list_buttons[i].SetActive(false); }
}
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.R))
{
// Restart.RestartGame();
StartCoroutine(Timer("restart"));
}
if (Input.GetKeyDown(KeyCode.N))
{
StartCoroutine(Timer("next_level"));
}
if (Input.GetKeyDown(KeyCode.Z))
{
chustitelnost -= 0.1f;
Voice.self.slider(chustitelnost);
// Debug.Log(chustitelnost);
}
if (Input.GetKeyDown(KeyCode.X))
{
chustitelnost += 0.1f;
Voice.self.slider(chustitelnost);
// Debug.Log(chustitelnost);
}
if (Input.GetKeyDown(KeyCode.Q))
{
ValListButtion();
}
}
}