質問編集履歴
1
現在アタッチしているスクリプトを記述
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,6 +8,95 @@
|
|
8
8
|
|
9
9
|
Timelineを活用できないか試しましたが特定の位置に来たら、という条件では使用できないようなので断念しました
|
10
10
|
|
11
|
+
### 追記
|
12
|
+
|
13
|
+
現在イベントを発生させるため空オブジェクトにアタッチしているスクリプトになります。
|
14
|
+
```C#
|
15
|
+
using System.Collections;
|
16
|
+
using System.Collections.Generic;
|
17
|
+
using UnityEngine;
|
18
|
+
using UnityEngine.UI;
|
19
|
+
|
20
|
+
public class Turorial : MonoBehaviour
|
21
|
+
{
|
22
|
+
List<string> Texts = new List<string>
|
23
|
+
{ "セリフ1", "セリフ2", "セリフ3",
|
24
|
+
"セリフ4","セリフ5" };
|
25
|
+
|
26
|
+
[SerializeField] private Text test;
|
27
|
+
[SerializeField] private Pausable pausable;
|
28
|
+
[SerializeField] private GameObject Serif_Player;
|
29
|
+
[SerializeField] private GameObject Serif_Sistem;
|
30
|
+
|
31
|
+
[SerializeField] private Player player;
|
32
|
+
|
33
|
+
void Start()
|
34
|
+
{
|
35
|
+
StartCoroutine(Walk());
|
36
|
+
}
|
37
|
+
|
38
|
+
void Update()
|
39
|
+
{
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
private IEnumerator Walk()
|
44
|
+
{
|
45
|
+
yield return new WaitForSeconds(2f);
|
46
|
+
//プレイヤーの動きなどを止める
|
47
|
+
pausable.pausing = true;
|
48
|
+
//メッセージウィンドウを表示
|
49
|
+
Serif_Player.SetActive(true);
|
50
|
+
Serif_Sistem.SetActive(false);
|
51
|
+
for (int i = 0; i <= 2; i++)
|
52
|
+
{
|
53
|
+
if(i == 2)
|
54
|
+
{
|
55
|
+
Serif_Player.SetActive(false);
|
56
|
+
Serif_Sistem.SetActive(true);
|
57
|
+
pausable.pausing = false;
|
58
|
+
}
|
59
|
+
test.text = Texts[i];
|
60
|
+
//タッチでメッセージを送る
|
61
|
+
yield return new WaitUntil(Touch);
|
62
|
+
yield return new WaitWhile(Touch);
|
63
|
+
}
|
64
|
+
yield return new WaitForSeconds(1f);
|
65
|
+
Serif_Sistem.SetActive(false);
|
66
|
+
test.text = "";
|
67
|
+
yield break;
|
68
|
+
}
|
69
|
+
|
70
|
+
private IEnumerator Key()
|
71
|
+
{
|
72
|
+
player.DashAnim_Stop();
|
73
|
+
pausable.pausing = true;
|
74
|
+
Serif_Player.SetActive(true);
|
75
|
+
for (int i = 3; i <= 4; i++)
|
76
|
+
{
|
77
|
+
test.text = Texts[i];
|
78
|
+
yield return new WaitUntil(Touch);
|
79
|
+
yield return new WaitWhile(Touch);
|
80
|
+
}
|
81
|
+
Serif_Player.SetActive(false);
|
82
|
+
test.text = "";
|
83
|
+
pausable.pausing = false;
|
84
|
+
yield break;
|
85
|
+
}
|
86
|
+
|
87
|
+
void OnTriggerEnter2D(Collider2D col)
|
88
|
+
{
|
89
|
+
StartCoroutine(Key());
|
90
|
+
}
|
91
|
+
|
92
|
+
bool Touch()
|
93
|
+
{
|
94
|
+
return Input.anyKeyDown;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
```
|
99
|
+
|
11
100
|
### 補足情報(FW/ツールのバージョンなど)
|
12
101
|
|
13
102
|
Unity2018.3.5f1
|