思考并回答以下问题:
先对着已做好的项目,一直看,把里面的各种逻辑弄明白,然后试着删除一些脚本,再自己加上。
然后把逻辑搞清后,用框架去做。
强迫自己。你当然不想。你就想躺在沙发上刷微博。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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class UI_startButton : MonoBehaviour {
private Transform thisT;
public GameObject controlPosition;
public GameObject controlButtonPosition;
public GameObject StartButtonPosition;
public GameObject ScrollViewPosition;
public GameObject gameNamePoint;
public GameObject quitButtonPosition;
public GameObject movePoint;
public GameObject movePointSe;
public GameObject scrollView;
public GameObject movePointTh;
public GameObject movePointFor;
public GameObject movePointFif;
public GameObject controlButton;
private bool startButtonFlag = false;
private bool controlButtonFlag = false;
private bool helpButtonFlag = false;
public Image controlDisplay;
public GameObject moveDownOne;
public GameObject moveDownTwo;
public GameObject moveDownThree;
public GameObject moveDownFour;
public GameObject moveDownFif;
private int escapeTimes = 0;
private bool isMain = true;
private bool back = false;
public GameObject train;
public GameObject gameName;
public GameObject quitImage;
public GameObject quitButton;
public GameObject mScrollView;
public GameObject mScrollViewPo;
public GameObject mScrollViewCen;
// Use this for initialization
void Start () {
thisT = this.transform;
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.Escape))
{
escapeTimes++;
StartCoroutine("resetTimes");
if (isMain && escapeTimes == 1)
{
// Application.Quit();
quitImage.SetActive(true);
}else if(!isMain && escapeTimes ==1)
{
back = true;
isMain = true;
startButtonFlag = false;
controlButtonFlag = false;
}
}
if (startButtonFlag)
{
Vector3 current = thisT.position;
Vector3 direc = movePoint.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
thisT.position = current;
current = scrollView.transform.position;
direc = movePointSe.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 5);
scrollView.transform.position = current;
current = controlButton.transform.position;
direc = movePointTh.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
controlButton.transform.position = current;
current = gameName.transform.position;
direc = movePointFor.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
gameName.transform.position = current;
current = quitButton.transform.position;
direc = movePointFif.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 8);
quitButton.transform.position = current;
}
else if(controlButtonFlag)
{
Vector3 current = thisT.position;
Vector3 direc = moveDownOne.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
thisT.position = current;
current = controlButton.transform.position;
direc = moveDownTwo.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
controlButton.transform.position = current;
current = controlDisplay.transform.position;
direc = moveDownThree.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 5);
controlDisplay.transform.position = current;
current = gameName.transform.position;
direc = moveDownFour.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 5);
gameName.transform.position = current;
current = quitButton.transform.position;
direc = moveDownFif.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
quitButton.transform.position = current;
}
else if (helpButtonFlag)
{
Vector3 current = thisT.position;
Vector3 direc = moveDownOne.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
thisT.position = current;
current = controlButton.transform.position;
direc = moveDownTwo.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
controlButton.transform.position = current;
current = gameName.transform.position;
direc = moveDownFour.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 5);
gameName.transform.position = current;
current = quitButton.transform.position;
direc = moveDownFif.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
quitButton.transform.position = current;
current = mScrollView.transform.position;
direc = mScrollViewCen.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
mScrollView.transform.position = current;
}
else if (back)
{
Vector3 current = thisT.position;
Vector3 direc = StartButtonPosition.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
thisT.position = current;
current = controlDisplay.transform.position;
direc = controlPosition.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 7);
controlDisplay.transform.position = current;
current = controlButton.transform.position;
direc = controlButtonPosition.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 5);
controlButton.transform.position = current;
current = scrollView.transform.position;
direc = ScrollViewPosition.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 5);
scrollView.transform.position = current;
current = gameName.transform.position;
direc = gameNamePoint.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 8);
gameName.transform.position = current;
current = quitButton.transform.position;
direc = quitButtonPosition.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 8);
quitButton.transform.position = current;
current = mScrollView.transform.position;
direc = mScrollViewPo.transform.position;
current = Vector3.Lerp(current, direc, Time.deltaTime * 8);
mScrollView.transform.position = current;
}
}
//开始游戏按钮
public void click()
{
startButtonFlag = true;
isMain = false;
}
//进入第一关
public void choiceGameOne()
{
F_staticNum.isStartSence = false;
Application.LoadLevelAsync("TGameOne");
}
//进入第二关
public void choiceGameTwo()
{
F_controlEmdPoint.color = 5;
F_staticNum.isStartSence = false;
Application.LoadLevelAsync("TGameTwo");
}
//控制背景音乐和音效
public void controlAudio()
{
isMain = true;
back = true;
startButtonFlag = false;
controlButtonFlag = false;
}
//控制按钮
public void controlAudioFlag()
{
controlButtonFlag = true;
isMain = false;
}
IEnumerator resetTimes()
{
yield return new WaitForSeconds(1);
escapeTimes = 0;
}
//确认退出游戏
public void quit()
{
Application.Quit();
}
//取消退出游戏
public void cancel()
{
this.GetComponent<Button>().enabled = true;
controlButton.GetComponent<Button>().enabled = true;
quitImage.SetActive(false);
}
//退出按钮
public void quitButtonClick()
{
this.GetComponent<Button>().enabled = false;
controlButton.GetComponent<Button>().enabled = false;
quitImage.SetActive(true);
}
//返回按钮
public void backClick()
{
back = true;
isMain = true;
startButtonFlag = false;
controlButtonFlag = false;
helpButtonFlag = false;
}
//帮助按钮
public void helpClick()
{
helpButtonFlag = true;
isMain = false;
Debug.Log("Help");
}
}