質問編集履歴
4
更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,30 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
バージョンは2018.3.8f1です。
|
4
|
-
|
5
|
-
``````
|
6
|
-
|
7
|
-
UnityException: GetInt is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'MapManager' on game object 'Map manager'.
|
8
|
-
|
9
|
-
See "Script Serialization" page in the Unity Manual for further details.
|
10
|
-
|
11
|
-
UnityEngine.PlayerPrefs.GetInt (System.String key) (at
|
1
|
+
コード
|
12
2
|
|
13
3
|
```
|
14
4
|
|
15
|
-
このようなエラーが出てスクリプトが反応しません。どうしたらいいですか?回答お願いします。
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
コード
|
20
|
-
|
21
|
-
````````
|
22
|
-
|
23
|
-
using System.Collections;
|
24
|
-
|
25
|
-
using System.Collections.Generic;
|
26
|
-
|
27
|
-
|
5
|
+
//略
|
28
6
|
|
29
7
|
using UnityEngine.UI;
|
30
8
|
|
@@ -34,15 +12,11 @@
|
|
34
12
|
|
35
13
|
{
|
36
14
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
15
|
public GameObject Player;
|
42
16
|
|
43
17
|
public static int EnemyNUM;
|
44
18
|
|
45
|
-
public static float PXP;
|
19
|
+
public static float PXP;
|
46
20
|
|
47
21
|
public static float PYP;
|
48
22
|
|
@@ -82,56 +56,10 @@
|
|
82
56
|
|
83
57
|
public GameObject BSA;
|
84
58
|
|
85
|
-
public GameObject BSA1;
|
86
|
-
|
87
|
-
public GameObject BSA2;
|
88
|
-
|
89
|
-
public GameObject BSA3;
|
90
|
-
|
91
|
-
public GameObject BSA4;
|
92
|
-
|
93
|
-
public GameObject BSA5;
|
94
|
-
|
95
|
-
public GameObject BSA6;
|
96
|
-
|
97
|
-
public GameObject BSA7;
|
98
|
-
|
99
|
-
public GameObject BSA8;
|
100
|
-
|
101
|
-
public GameObject BSA9;
|
102
|
-
|
103
|
-
public GameObject BSA10;
|
104
|
-
|
105
|
-
public GameObject BSA11;
|
106
|
-
|
107
|
-
public GameObject BSA12;
|
108
|
-
|
109
|
-
public GameObject BSA13;
|
110
|
-
|
111
|
-
public GameObject BSA14;
|
112
|
-
|
113
|
-
public GameObject BSA15;
|
114
|
-
|
115
|
-
public GameObject BSA16;
|
116
|
-
|
117
|
-
public GameObject BSA17;
|
118
|
-
|
119
|
-
public GameObject BSA18;
|
120
|
-
|
121
|
-
public GameObject BSA19;
|
122
|
-
|
123
|
-
|
59
|
+
//略
|
124
|
-
|
125
|
-
public GameObject BSA21;
|
126
|
-
|
127
|
-
public GameObject BSAX;
|
128
|
-
|
129
|
-
public GameObject BSAY;
|
130
60
|
|
131
61
|
public GameObject BSAZ;
|
132
62
|
|
133
|
-
|
134
|
-
|
135
63
|
void start()
|
136
64
|
|
137
65
|
{
|
@@ -152,53 +80,9 @@
|
|
152
80
|
|
153
81
|
messagewindow.text = "";
|
154
82
|
|
155
|
-
|
156
|
-
|
157
83
|
BSA.SetActive(false);
|
158
84
|
|
159
|
-
BSA1.SetActive(false);
|
160
|
-
|
161
|
-
BSA3.SetActive(false);
|
162
|
-
|
163
|
-
BSA4.SetActive(false);
|
164
|
-
|
165
|
-
BSA5.SetActive(false);
|
166
|
-
|
167
|
-
BSA6.SetActive(false);
|
168
|
-
|
169
|
-
BSA7.SetActive(false);
|
170
|
-
|
171
|
-
BSA8.SetActive(false);
|
172
|
-
|
173
|
-
BSA9.SetActive(false);
|
174
|
-
|
175
|
-
BSA10.SetActive(false);
|
176
|
-
|
177
|
-
BSA11.SetActive(false);
|
178
|
-
|
179
|
-
|
85
|
+
//略
|
180
|
-
|
181
|
-
BSA13.SetActive(false);
|
182
|
-
|
183
|
-
BSA14.SetActive(false);
|
184
|
-
|
185
|
-
BSA15.SetActive(false);
|
186
|
-
|
187
|
-
BSA16.SetActive(false);
|
188
|
-
|
189
|
-
BSA17.SetActive(false);
|
190
|
-
|
191
|
-
BSA18.SetActive(false);
|
192
|
-
|
193
|
-
BSA19.SetActive(false);
|
194
|
-
|
195
|
-
BSA20.SetActive(false);
|
196
|
-
|
197
|
-
BSA21.SetActive(false);
|
198
|
-
|
199
|
-
BSAX.SetActive(false);
|
200
|
-
|
201
|
-
BSAY.SetActive(false);
|
202
86
|
|
203
87
|
BSAZ.SetActive(false);
|
204
88
|
|
@@ -210,8 +94,6 @@
|
|
210
94
|
|
211
95
|
{
|
212
96
|
|
213
|
-
|
214
|
-
|
215
97
|
flee = 1;
|
216
98
|
|
217
99
|
MSGM.Hyouzi();
|
@@ -222,17 +104,13 @@
|
|
222
104
|
|
223
105
|
{
|
224
106
|
|
225
|
-
|
226
|
-
|
227
|
-
var outputText = msg.Substring(i, 1);
|
107
|
+
var outputText = msg.Substring(i, 1);
|
228
|
-
|
229
|
-
|
230
|
-
|
108
|
+
|
231
|
-
messagewindow.text = messagewindow.text + outputText;
|
109
|
+
messagewindow.text = messagewindow.text + outputText;
|
232
|
-
|
233
|
-
|
234
|
-
|
110
|
+
|
111
|
+
|
112
|
+
|
235
|
-
yield return new WaitForSeconds(Wait);
|
113
|
+
yield return new WaitForSeconds(Wait);
|
236
114
|
|
237
115
|
}
|
238
116
|
|
@@ -256,10 +134,6 @@
|
|
256
134
|
|
257
135
|
}
|
258
136
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
137
|
void Update()
|
264
138
|
|
265
139
|
{
|
@@ -354,8 +228,6 @@
|
|
354
228
|
|
355
229
|
MSGM.HIHyouzi();
|
356
230
|
|
357
|
-
|
358
|
-
|
359
231
|
}
|
360
232
|
|
361
233
|
else
|
@@ -366,8 +238,6 @@
|
|
366
238
|
|
367
239
|
}
|
368
240
|
|
369
|
-
|
370
|
-
|
371
241
|
}
|
372
242
|
|
373
243
|
else
|
@@ -378,225 +248,87 @@
|
|
378
248
|
|
379
249
|
}
|
380
250
|
|
251
|
+
}
|
252
|
+
|
253
|
+
IEnumerator BattleStart()
|
254
|
+
|
255
|
+
{
|
256
|
+
|
257
|
+
WorldNUM = PlayerS.WorldNumber;
|
258
|
+
|
259
|
+
if (WorldNUM == 1)
|
260
|
+
|
261
|
+
{
|
262
|
+
|
263
|
+
EnemyNUM = Random.Range(96, 100);
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
StartCoroutine("BattleStartAnimation");
|
268
|
+
|
269
|
+
flee = 2;
|
270
|
+
|
271
|
+
while (flee == 0)
|
272
|
+
|
273
|
+
{
|
274
|
+
|
275
|
+
yield return new WaitForSeconds(0.01f);
|
276
|
+
|
277
|
+
}
|
278
|
+
|
279
|
+
PXP = Player.transform.position.x;
|
280
|
+
|
281
|
+
PYP = Player.transform.position.y;
|
282
|
+
|
283
|
+
SceneManager.LoadScene("Kyanon Battle Scene");
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
}
|
288
|
+
|
289
|
+
IEnumerator BattleStartAnimation()
|
290
|
+
|
291
|
+
{
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
float X = Player.transform.position.x;
|
296
|
+
|
297
|
+
float Y = Player.transform.position.y;
|
298
|
+
|
299
|
+
ALLBSA.transform.position = new Vector2(X-11.7f,Y+6.3f);
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
yield return new WaitForSeconds(0.02f);
|
306
|
+
|
307
|
+
BSA.SetActive(true);
|
308
|
+
|
309
|
+
//省略
|
310
|
+
|
311
|
+
BSAZ.SetActive(true);
|
312
|
+
|
313
|
+
yield return new WaitForSeconds(0.3f);
|
314
|
+
|
315
|
+
BSA.SetActive(false);
|
316
|
+
|
317
|
+
//略
|
318
|
+
|
319
|
+
BSAZ.SetActive(false);
|
320
|
+
|
321
|
+
flee = 0;
|
322
|
+
|
381
323
|
|
382
324
|
|
383
|
-
}
|
384
|
-
|
385
|
-
IEnumerator BattleStart()
|
386
|
-
|
387
|
-
{
|
388
|
-
|
389
|
-
WorldNUM = PlayerS.WorldNumber;
|
390
|
-
|
391
|
-
if (WorldNUM == 1)
|
392
|
-
|
393
|
-
{
|
394
|
-
|
395
|
-
EnemyNUM = Random.Range(96, 100);
|
396
|
-
|
397
|
-
}
|
398
|
-
|
399
|
-
StartCoroutine("BattleStartAnimation");
|
400
|
-
|
401
|
-
flee = 2;
|
402
|
-
|
403
|
-
while (flee == 0)
|
404
|
-
|
405
|
-
{
|
406
|
-
|
407
|
-
yield return new WaitForSeconds(0.01f);
|
408
|
-
|
409
|
-
}
|
410
|
-
|
411
|
-
PXP = Player.transform.position.x;
|
412
|
-
|
413
|
-
PYP = Player.transform.position.y;
|
414
|
-
|
415
|
-
SceneManager.LoadScene("Kyanon Battle Scene");
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
}
|
420
|
-
|
421
|
-
IEnumerator BattleStartAnimation()
|
422
|
-
|
423
|
-
{
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
float X = Player.transform.position.x;
|
428
|
-
|
429
|
-
float Y = Player.transform.position.y;
|
430
|
-
|
431
|
-
ALLBSA.transform.position = new Vector2(X-11.7f,Y+6.3f);
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
yield return new WaitForSeconds(0.02f);
|
438
|
-
|
439
|
-
BSA.SetActive(true);
|
440
|
-
|
441
|
-
yield return new WaitForSeconds(0.02f);
|
442
|
-
|
443
|
-
BSA1.SetActive(true);
|
444
|
-
|
445
|
-
yield return new WaitForSeconds(0.02f);
|
446
|
-
|
447
|
-
BSA3.SetActive(true);
|
448
|
-
|
449
|
-
yield return new WaitForSeconds(0.02f);
|
450
|
-
|
451
|
-
BSA4.SetActive(true);
|
452
|
-
|
453
|
-
yield return new WaitForSeconds(0.02f);
|
454
|
-
|
455
|
-
BSA5.SetActive(true);
|
456
|
-
|
457
|
-
yield return new WaitForSeconds(0.02f);
|
458
|
-
|
459
|
-
BSA6.SetActive(true);
|
460
|
-
|
461
|
-
yield return new WaitForSeconds(0.02f);
|
462
|
-
|
463
|
-
BSA7.SetActive(true);
|
464
|
-
|
465
|
-
yield return new WaitForSeconds(0.02f);
|
466
|
-
|
467
|
-
BSA8.SetActive(true);
|
468
|
-
|
469
|
-
yield return new WaitForSeconds(0.02f);
|
470
|
-
|
471
|
-
BSA9.SetActive(true);
|
472
|
-
|
473
|
-
yield return new WaitForSeconds(0.02f);
|
474
|
-
|
475
|
-
BSA10.SetActive(true);
|
476
|
-
|
477
|
-
yield return new WaitForSeconds(0.02f);
|
478
|
-
|
479
|
-
BSA11.SetActive(true);
|
480
|
-
|
481
|
-
yield return new WaitForSeconds(0.02f);
|
482
|
-
|
483
|
-
BSA12.SetActive(true);
|
484
|
-
|
485
|
-
yield return new WaitForSeconds(0.02f);
|
486
|
-
|
487
|
-
BSA13.SetActive(true);
|
488
|
-
|
489
|
-
yield return new WaitForSeconds(0.02f);
|
490
|
-
|
491
|
-
BSA14.SetActive(true);
|
492
|
-
|
493
|
-
yield return new WaitForSeconds(0.02f);
|
494
|
-
|
495
|
-
BSA15.SetActive(true);
|
496
|
-
|
497
|
-
yield return new WaitForSeconds(0.02f);
|
498
|
-
|
499
|
-
BSA16.SetActive(true);
|
500
|
-
|
501
|
-
yield return new WaitForSeconds(0.02f);
|
502
|
-
|
503
|
-
BSA17.SetActive(true);
|
504
|
-
|
505
|
-
yield return new WaitForSeconds(0.02f);
|
506
|
-
|
507
|
-
BSA18.SetActive(true);
|
508
|
-
|
509
|
-
yield return new WaitForSeconds(0.02f);
|
510
|
-
|
511
|
-
BSA19.SetActive(true);
|
512
|
-
|
513
|
-
yield return new WaitForSeconds(0.02f);
|
514
|
-
|
515
|
-
BSA20.SetActive(true);
|
516
|
-
|
517
|
-
yield return new WaitForSeconds(0.02f);
|
518
|
-
|
519
|
-
BSA21.SetActive(true);
|
520
|
-
|
521
|
-
yield return new WaitForSeconds(0.02f);
|
522
|
-
|
523
|
-
BSAX.SetActive(true);
|
524
|
-
|
525
|
-
yield return new WaitForSeconds(0.02f);
|
526
|
-
|
527
|
-
BSAY.SetActive(true);
|
528
|
-
|
529
|
-
yield return new WaitForSeconds(0.02f);
|
530
|
-
|
531
|
-
BSAZ.SetActive(true);
|
532
|
-
|
533
|
-
yield return new WaitForSeconds(0.3f);
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
BSA.SetActive(false);
|
538
|
-
|
539
|
-
BSA1.SetActive(false);
|
540
|
-
|
541
|
-
BSA3.SetActive(false);
|
542
|
-
|
543
|
-
BSA4.SetActive(false);
|
544
|
-
|
545
|
-
BSA5.SetActive(false);
|
546
|
-
|
547
|
-
BSA6.SetActive(false);
|
548
|
-
|
549
|
-
BSA7.SetActive(false);
|
550
|
-
|
551
|
-
BSA8.SetActive(false);
|
552
|
-
|
553
|
-
BSA9.SetActive(false);
|
554
|
-
|
555
|
-
BSA10.SetActive(false);
|
556
|
-
|
557
|
-
BSA11.SetActive(false);
|
558
|
-
|
559
|
-
BSA12.SetActive(false);
|
560
|
-
|
561
|
-
BSA13.SetActive(false);
|
562
|
-
|
563
|
-
BSA14.SetActive(false);
|
564
|
-
|
565
|
-
BSA15.SetActive(false);
|
566
|
-
|
567
|
-
BSA16.SetActive(false);
|
568
|
-
|
569
|
-
BSA17.SetActive(false);
|
570
|
-
|
571
|
-
BSA18.SetActive(false);
|
572
|
-
|
573
|
-
BSA19.SetActive(false);
|
574
|
-
|
575
|
-
BSA20.SetActive(false);
|
576
|
-
|
577
|
-
BSA21.SetActive(false);
|
578
|
-
|
579
|
-
BSAX.SetActive(false);
|
580
|
-
|
581
|
-
BSAY.SetActive(false);
|
582
|
-
|
583
|
-
BSAZ.SetActive(false);
|
584
|
-
|
585
|
-
flee = 0;
|
586
|
-
|
587
|
-
|
588
|
-
|
589
325
|
|
590
326
|
|
591
327
|
}
|
592
328
|
|
593
329
|
IEnumerator Event1S()
|
594
330
|
|
595
|
-
{
|
331
|
+
{
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
332
|
|
601
333
|
}
|
602
334
|
|
@@ -630,8 +362,446 @@
|
|
630
362
|
|
631
363
|
}
|
632
364
|
|
633
|
-
```
|
365
|
+
```
|
366
|
+
|
634
|
-
|
367
|
+
関連コード1
|
368
|
+
|
369
|
+
```
|
370
|
+
|
371
|
+
//略
|
372
|
+
|
373
|
+
public class Player : MonoBehaviour
|
374
|
+
|
375
|
+
{
|
376
|
+
|
377
|
+
Animator animator;
|
378
|
+
|
379
|
+
public GameObject MapManagger;
|
380
|
+
|
381
|
+
MapManager script;
|
382
|
+
|
383
|
+
float movespeed;
|
384
|
+
|
385
|
+
public string C;
|
386
|
+
|
387
|
+
//PlayerPrefs.SetInt("Data", 10);
|
388
|
+
|
389
|
+
public int S = 0;
|
390
|
+
|
391
|
+
public int BRS;
|
392
|
+
|
393
|
+
public int WorldNumber;
|
394
|
+
|
395
|
+
public int BattleS;
|
396
|
+
|
397
|
+
// Start is called before the first frame update
|
398
|
+
|
399
|
+
void Start()
|
400
|
+
|
401
|
+
{
|
402
|
+
|
403
|
+
this.animator = GetComponent<Animator>();
|
404
|
+
|
635
|
-
|
405
|
+
script = MapManagger.GetComponent<MapManager>();
|
406
|
+
|
636
|
-
|
407
|
+
transform.position = new Vector2(29, -7);
|
408
|
+
|
409
|
+
}
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
// Update is called once per frame
|
414
|
+
|
415
|
+
void Update()
|
416
|
+
|
417
|
+
{
|
418
|
+
|
419
|
+
transform.rotation = Quaternion.Euler(0, 0, 0);
|
420
|
+
|
421
|
+
if (S == 0)
|
422
|
+
|
423
|
+
{
|
424
|
+
|
425
|
+
if ((Input.GetKey(KeyCode.UpArrow)) || (Input.GetKey(KeyCode.DownArrow)) || (Input.GetKey(KeyCode.RightArrow)) || (Input.GetKey(KeyCode.LeftArrow)))
|
426
|
+
|
427
|
+
{
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
movespeed = 0.125f;
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
this.animator.speed = (movespeed / 0.1f);
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
}
|
444
|
+
|
445
|
+
else
|
446
|
+
|
447
|
+
{
|
448
|
+
|
449
|
+
movespeed = 0;
|
450
|
+
|
637
|
-
|
451
|
+
this.animator.speed = 0;
|
452
|
+
|
453
|
+
}
|
454
|
+
|
455
|
+
}
|
456
|
+
|
457
|
+
else
|
458
|
+
|
459
|
+
{
|
460
|
+
|
461
|
+
movespeed = 0;
|
462
|
+
|
463
|
+
this.animator.speed = 0;
|
464
|
+
|
465
|
+
}
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
if (Input.GetKey(KeyCode.UpArrow))
|
470
|
+
|
471
|
+
{
|
472
|
+
|
473
|
+
animator.SetInteger("PL", 1);
|
474
|
+
|
475
|
+
transform.Translate(new Vector2(0, movespeed));
|
476
|
+
|
477
|
+
}
|
478
|
+
|
479
|
+
else
|
480
|
+
|
481
|
+
{
|
482
|
+
|
483
|
+
if (Input.GetKey(KeyCode.DownArrow))
|
484
|
+
|
485
|
+
{
|
486
|
+
|
487
|
+
animator.SetInteger("PL", 2);
|
488
|
+
|
489
|
+
transform.Translate(new Vector2(0, 0 - movespeed));
|
490
|
+
|
491
|
+
}
|
492
|
+
|
493
|
+
else
|
494
|
+
|
495
|
+
{
|
496
|
+
|
497
|
+
if (Input.GetKey(KeyCode.RightArrow))
|
498
|
+
|
499
|
+
{
|
500
|
+
|
501
|
+
animator.SetInteger("PL", 3);
|
502
|
+
|
503
|
+
transform.Translate(new Vector2(movespeed, 0));
|
504
|
+
|
505
|
+
}
|
506
|
+
|
507
|
+
else
|
508
|
+
|
509
|
+
{
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
if (Input.GetKey(KeyCode.LeftArrow))
|
514
|
+
|
515
|
+
{
|
516
|
+
|
517
|
+
animator.SetInteger("PL", 4);
|
518
|
+
|
519
|
+
transform.Translate(new Vector2(0 - movespeed, 0));
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
}
|
524
|
+
|
525
|
+
}
|
526
|
+
|
527
|
+
}
|
528
|
+
|
529
|
+
}
|
530
|
+
|
531
|
+
if (Input.GetKeyDown(KeyCode.UpArrow))
|
532
|
+
|
533
|
+
{
|
534
|
+
|
535
|
+
animator.SetInteger("PL", 1);
|
536
|
+
|
537
|
+
}
|
538
|
+
|
539
|
+
else
|
540
|
+
|
541
|
+
{
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
if (Input.GetKeyDown(KeyCode.DownArrow))
|
548
|
+
|
549
|
+
{
|
550
|
+
|
551
|
+
animator.SetInteger("PL", 2);
|
552
|
+
|
553
|
+
}
|
554
|
+
|
555
|
+
else
|
556
|
+
|
557
|
+
{
|
558
|
+
|
559
|
+
if (Input.GetKeyDown(KeyCode.RightArrow))
|
560
|
+
|
561
|
+
{
|
562
|
+
|
563
|
+
animator.SetInteger("PL", 3);
|
564
|
+
|
565
|
+
}
|
566
|
+
|
567
|
+
else
|
568
|
+
|
569
|
+
{
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
if (Input.GetKeyDown(KeyCode.LeftArrow))
|
574
|
+
|
575
|
+
{
|
576
|
+
|
577
|
+
animator.SetInteger("PL", 4);
|
578
|
+
|
579
|
+
}
|
580
|
+
|
581
|
+
}
|
582
|
+
|
583
|
+
}
|
584
|
+
|
585
|
+
}
|
586
|
+
|
587
|
+
}
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
// }
|
594
|
+
|
595
|
+
void OnCollisionEnter2D(Collision2D collision)
|
596
|
+
|
597
|
+
{
|
598
|
+
|
599
|
+
Debug.Log("OnCollisionEnter2D: " + collision.gameObject.name);
|
600
|
+
|
601
|
+
C = collision.gameObject.name;
|
602
|
+
|
603
|
+
if(C == "Trigger1")
|
604
|
+
|
605
|
+
{
|
606
|
+
|
607
|
+
Warp1();
|
608
|
+
|
609
|
+
}
|
610
|
+
|
611
|
+
if (C == "Trigger2")
|
612
|
+
|
613
|
+
{
|
614
|
+
|
615
|
+
script.Event1();
|
616
|
+
|
617
|
+
}
|
618
|
+
|
619
|
+
if (C == "Map1")
|
620
|
+
|
621
|
+
{
|
622
|
+
|
623
|
+
|
624
|
+
|
625
|
+
}
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
}
|
630
|
+
|
631
|
+
void OnCollisionStay2D(Collision2D collision)
|
632
|
+
|
633
|
+
{
|
634
|
+
|
635
|
+
C = collision.gameObject.name;
|
636
|
+
|
637
|
+
if(C == "Map1")
|
638
|
+
|
639
|
+
{
|
640
|
+
|
641
|
+
WorldNumber = 1;
|
642
|
+
|
643
|
+
}
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
if (Input.GetKeyDown(KeyCode.Z))
|
648
|
+
|
649
|
+
{
|
650
|
+
|
651
|
+
|
652
|
+
|
653
|
+
if (C == "Map1")
|
654
|
+
|
655
|
+
{
|
656
|
+
|
657
|
+
script.CMN = 1;
|
658
|
+
|
659
|
+
}
|
660
|
+
|
661
|
+
|
662
|
+
|
663
|
+
script.CMM();
|
664
|
+
|
665
|
+
Debug.Log("OnCollisionStay2D");
|
666
|
+
|
667
|
+
}
|
668
|
+
|
669
|
+
}
|
670
|
+
|
671
|
+
void OnTriggerEnter2D(Collider2D collision)
|
672
|
+
|
673
|
+
{
|
674
|
+
|
675
|
+
Debug.Log("OnTriggerEnter2D: " + collision.gameObject.name);
|
676
|
+
|
677
|
+
C = collision.gameObject.name;
|
678
|
+
|
679
|
+
if (C == "Trigger2")
|
680
|
+
|
681
|
+
{
|
682
|
+
|
683
|
+
int PS = PlayerPrefs.GetInt("Trigger2");
|
684
|
+
|
685
|
+
if (PS != 1)
|
686
|
+
|
687
|
+
{
|
688
|
+
|
689
|
+
script.Event1();
|
690
|
+
|
691
|
+
PlayerPrefs.SetInt("Trigger2",1);
|
692
|
+
|
693
|
+
}
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
}
|
698
|
+
|
699
|
+
}
|
700
|
+
|
701
|
+
void Warp1()
|
702
|
+
|
703
|
+
{
|
704
|
+
|
705
|
+
transform.position = new Vector2(-22, -43f);
|
706
|
+
|
707
|
+
}
|
708
|
+
|
709
|
+
void Battle()
|
710
|
+
|
711
|
+
{
|
712
|
+
|
713
|
+
if (BattleS == 0)
|
714
|
+
|
715
|
+
{
|
716
|
+
|
717
|
+
BRS = Random.Range(1, 200);
|
718
|
+
|
719
|
+
if (BRS >= 180)
|
720
|
+
|
721
|
+
{
|
722
|
+
|
723
|
+
script.BattleStartS();
|
724
|
+
|
725
|
+
}
|
726
|
+
|
727
|
+
}
|
728
|
+
|
729
|
+
}
|
730
|
+
|
731
|
+
}
|
732
|
+
|
733
|
+
```
|
734
|
+
|
735
|
+
関連コード2
|
736
|
+
|
737
|
+
```
|
738
|
+
|
739
|
+
//略
|
740
|
+
|
741
|
+
public class messageinthemap : MonoBehaviour
|
742
|
+
|
743
|
+
{
|
744
|
+
|
745
|
+
float X;
|
746
|
+
|
747
|
+
float Y;
|
748
|
+
|
749
|
+
|
750
|
+
|
751
|
+
public GameObject player;
|
752
|
+
|
753
|
+
Player playerS;
|
754
|
+
|
755
|
+
|
756
|
+
|
757
|
+
// Use this for initialization
|
758
|
+
|
759
|
+
void Start()
|
760
|
+
|
761
|
+
{
|
762
|
+
|
763
|
+
transform.position = new Vector2(100, 0);
|
764
|
+
|
765
|
+
playerS = player.GetComponent<Player>();
|
766
|
+
|
767
|
+
}
|
768
|
+
|
769
|
+
// Update is called once per frame
|
770
|
+
|
771
|
+
void Update()
|
772
|
+
|
773
|
+
{
|
774
|
+
|
775
|
+
|
776
|
+
|
777
|
+
|
778
|
+
|
779
|
+
}
|
780
|
+
|
781
|
+
public void Hyouzi()
|
782
|
+
|
783
|
+
{
|
784
|
+
|
785
|
+
playerS.S = 1;
|
786
|
+
|
787
|
+
X = player.transform.position.x;
|
788
|
+
|
789
|
+
Y = player.transform.position.y;
|
790
|
+
|
791
|
+
transform.position = new Vector2(X, Y - 5);
|
792
|
+
|
793
|
+
}
|
794
|
+
|
795
|
+
public void HIHyouzi()
|
796
|
+
|
797
|
+
{
|
798
|
+
|
799
|
+
playerS.S = 0;
|
800
|
+
|
801
|
+
transform.position = new Vector2(100, 0);
|
802
|
+
|
803
|
+
}
|
804
|
+
|
805
|
+
}
|
806
|
+
|
807
|
+
```
|
3
改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -632,4 +632,6 @@
|
|
632
632
|
|
633
633
|
`````
|
634
634
|
|
635
|
+
このスクリプトがアタッチされたオブジェクトのInspectorのMapManagerの欄が半透明になっていました。
|
636
|
+
|
635
637
|
voidstartのDebug.Logは出ませんでした。
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -631,3 +631,5 @@
|
|
631
631
|
}
|
632
632
|
|
633
633
|
`````
|
634
|
+
|
635
|
+
voidstartのDebug.Logは出ませんでした。
|