質問編集履歴

2

誤字

2018/08/14 22:42

投稿

yukidama
yukidama

スコア11

test CHANGED
File without changes
test CHANGED
@@ -22,6 +22,8 @@
22
22
 
23
23
  スクリプト修正しました。highscore10点で関数を呼びSetActiveをfalseにしていますがエラーは出ませんがボタンは出たままです。
24
24
 
25
+ appleも点数を保持しています
26
+
25
27
 
26
28
 
27
29
  GameObject AppleText;

1

誤字

2018/08/14 22:42

投稿

yukidama
yukidama

スコア11

test CHANGED
File without changes
test CHANGED
@@ -20,9 +20,7 @@
20
20
 
21
21
 
22
22
 
23
-
24
-
25
- public class GameDirector : MonoBehaviour {
23
+ スクリプト修正しました。highscore10点で関数を呼びSetActiveをfalseにしていますがエラーは出ませんがボタンは出たままです。
26
24
 
27
25
 
28
26
 
@@ -40,17 +38,19 @@
40
38
 
41
39
  public Text HighScoreText;
42
40
 
43
-
41
+ public Text AppleScoreText;
44
-
45
-
46
-
42
+
43
+
44
+
45
+
46
+
47
-    int highScore;
47
+ int highScore;
48
48
 
49
49
 
50
50
 
51
51
  private string key = "HIGHSCORE";
52
52
 
53
-
53
+ private string key2 = "APPLE";
54
54
 
55
55
 
56
56
 
@@ -124,6 +124,12 @@
124
124
 
125
125
 
126
126
 
127
+ apple= PlayerPrefs.GetInt (key2, 0);
128
+
129
+ AppleScoreText.text = apple.ToString () + "apple";
130
+
131
+
132
+
127
133
 
128
134
 
129
135
  }
@@ -140,9 +146,9 @@
140
146
 
141
147
 
142
148
 
143
- AppleText.GetComponent<Text> ().text =
149
+ // AppleText.GetComponent<Text> ().text =
144
-
150
+
145
- apple.ToString () + "apple";
151
+ // apple.ToString () + "apple";
146
152
 
147
153
 
148
154
 
@@ -192,6 +198,16 @@
192
198
 
193
199
 
194
200
 
201
+ PlayerPrefs.SetInt (key2, apple);
202
+
203
+
204
+
205
+ AppleScoreText.text = apple.ToString () + "apple";
206
+
207
+
208
+
209
+
210
+
195
211
 
196
212
 
197
213
  if (highScore >= 20) {
@@ -214,6 +230,10 @@
214
230
 
215
231
  if (highScore >= 10) {
216
232
 
233
+
234
+
235
+ GameObject.Find ("Buttonmap2").GetComponent<ButtonActive> ().GetButton2 ();
236
+
217
237
  SceneManager.LoadScene ("map1");
218
238
 
219
239
 
@@ -222,7 +242,9 @@
222
242
 
223
243
  if (highScore >= 20) {
224
244
 
245
+
246
+
225
- SceneManager.LoadScene ("Map2");
247
+ SceneManager.LoadScene ("map2");
226
248
 
227
249
 
228
250