質問編集履歴
4
無関係のコードを削除しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,12 +1,6 @@
|
|
1
|
-
### 前提・実現したいこと
|
2
|
-
|
3
1
|
### 発生している問題・エラーメッセージ
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
![イメージ説明](07f1b4d7d4edd47ab3ceef268f6c32c4.jpeg)
|
8
|
-
|
9
|
-
|
3
|
+
弾を二重に作って、発射させていますが、
|
10
4
|
|
11
5
|
移動先で作り始めると、移動前で作っていた弾の生成が途中で中断されてしまいます。
|
12
6
|
|
@@ -18,197 +12,11 @@
|
|
18
12
|
|
19
13
|
### 該当のソースコード
|
20
14
|
|
21
|
-
|
22
|
-
|
23
|
-
```C#
|
24
|
-
|
25
|
-
//移動座標
|
26
|
-
|
27
|
-
public Vector3 aP1;
|
28
|
-
|
29
|
-
public Vector3 aP2;
|
30
|
-
|
31
|
-
public Vector3 aP3;
|
32
|
-
|
33
|
-
public Vector3 aP4;
|
34
|
-
|
35
|
-
public Vector3 aP5;
|
36
|
-
|
37
|
-
public Vector3 aP6;
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
//待機時間
|
42
|
-
|
43
|
-
public float startWait;
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
private IEnumerator m_Coroutine;
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
//生成するPrefab
|
52
|
-
|
53
|
-
public GameObject prefab;
|
54
|
-
|
55
|
-
//生成数
|
56
|
-
|
57
|
-
public int count;
|
58
|
-
|
59
|
-
//中心点のオブジェクト
|
60
|
-
|
61
|
-
public GameObject center;
|
62
|
-
|
63
|
-
//距離1
|
64
|
-
|
65
|
-
public float distance;
|
66
|
-
|
67
|
-
//距離2
|
68
|
-
|
69
|
-
public float distance2;
|
70
|
-
|
71
|
-
//中心点の方向に向けるか
|
72
|
-
|
73
|
-
public bool isLookAtCenter = true;
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
IEnumerator Start()
|
78
|
-
|
79
|
-
{
|
80
|
-
|
81
|
-
yield return new WaitForSeconds(startWait);
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
AttackSequence(1);
|
86
|
-
|
87
|
-
yield return new WaitForSeconds(2f);
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
AttackSequence(2);
|
92
|
-
|
93
|
-
yield return new WaitForSeconds(2f);
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
AttackSequence(3);
|
98
|
-
|
99
|
-
yield return new WaitForSeconds(2f);
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
AttackSequence(4);
|
104
|
-
|
105
|
-
yield return new WaitForSeconds(2f);
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
AttackSequence(5);
|
110
|
-
|
111
|
-
yield return new WaitForSeconds(2f);
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
AttackSequence(6);
|
116
|
-
|
117
|
-
yield break;
|
118
|
-
|
119
|
-
}
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
public Sequence AttackSequence(int num)
|
124
|
-
|
125
|
-
{
|
126
|
-
|
127
|
-
Sequence seq = DOTween.Sequence();
|
128
|
-
|
129
|
-
barrage_1 = this.gameObject.GetComponent<barrage_1>();
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
Vector3 aP = new Vector3(0,0,0);
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
if (num == 1)
|
138
|
-
|
139
|
-
{
|
140
|
-
|
141
|
-
aP = aP1;
|
142
|
-
|
143
|
-
}
|
144
|
-
|
145
|
-
else if(num == 2)
|
146
|
-
|
147
|
-
{
|
148
|
-
|
149
|
-
aP = aP2;
|
150
|
-
|
151
|
-
}
|
152
|
-
|
153
|
-
else if (num == 3)
|
154
|
-
|
155
|
-
{
|
156
|
-
|
157
|
-
aP = aP3;
|
158
|
-
|
159
|
-
}
|
160
|
-
|
161
|
-
else if (num == 4)
|
162
|
-
|
163
|
-
{
|
164
|
-
|
165
|
-
aP = aP4;
|
166
|
-
|
167
|
-
}
|
168
|
-
|
169
|
-
else if (num == 5)
|
170
|
-
|
171
|
-
{
|
172
|
-
|
173
|
-
aP = aP5;
|
174
|
-
|
175
|
-
}
|
176
|
-
|
177
|
-
else if (num == 6)
|
178
|
-
|
179
|
-
{
|
180
|
-
|
181
|
-
aP = aP6;
|
182
|
-
|
183
|
-
}
|
184
|
-
|
185
|
-
//移動
|
186
|
-
|
187
|
-
seq.Append(transform.DOMove(aP, 2f).SetEase(Ease.OutCubic).OnComplete(() =>
|
188
|
-
|
189
|
-
{
|
190
|
-
|
191
|
-
// コルーチン開始
|
192
|
-
|
193
|
-
m_Coroutine = barrage_1.Generate(prefab, count, center, distance, distance2, isLookAtCenter);
|
194
|
-
|
195
|
-
barrage_1.StartCoroutine(m_Coroutine);
|
196
|
-
|
197
|
-
}));
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
return seq;
|
202
|
-
|
203
|
-
}
|
204
|
-
|
205
|
-
```
|
206
|
-
|
207
15
|
```C#
|
208
16
|
|
209
17
|
//↓これのせい
|
210
18
|
|
211
|
-
public IEnumerator Generate(GameObject prefab, int count, GameObject center, float distance,
|
19
|
+
public IEnumerator Generate(GameObject prefab, int count, GameObject center, float distance, bool isLookAtCenter = true)
|
212
20
|
|
213
21
|
{
|
214
22
|
|
3
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -182,7 +182,7 @@
|
|
182
182
|
|
183
183
|
}
|
184
184
|
|
185
|
-
//
|
185
|
+
//移動
|
186
186
|
|
187
187
|
seq.Append(transform.DOMove(aP, 2f).SetEase(Ease.OutCubic).OnComplete(() =>
|
188
188
|
|
2
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -188,9 +188,7 @@
|
|
188
188
|
|
189
189
|
{
|
190
190
|
|
191
|
-
// コルーチン開始
|
191
|
+
// コルーチン開始
|
192
|
-
|
193
|
-
//シーケンス後に呼び出しにしないと、AttackSequence();が実行された後すぐに実行されてしまい、到着前に発動してしまう
|
194
192
|
|
195
193
|
m_Coroutine = barrage_1.Generate(prefab, count, center, distance, distance2, isLookAtCenter);
|
196
194
|
|
1
追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,32 @@
|
|
22
22
|
|
23
23
|
```C#
|
24
24
|
|
25
|
+
//移動座標
|
26
|
+
|
27
|
+
public Vector3 aP1;
|
28
|
+
|
29
|
+
public Vector3 aP2;
|
30
|
+
|
31
|
+
public Vector3 aP3;
|
32
|
+
|
33
|
+
public Vector3 aP4;
|
34
|
+
|
35
|
+
public Vector3 aP5;
|
36
|
+
|
37
|
+
public Vector3 aP6;
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
//待機時間
|
42
|
+
|
43
|
+
public float startWait;
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
private IEnumerator m_Coroutine;
|
48
|
+
|
49
|
+
|
50
|
+
|
25
51
|
//生成するPrefab
|
26
52
|
|
27
53
|
public GameObject prefab;
|
@@ -52,12 +78,12 @@
|
|
52
78
|
|
53
79
|
{
|
54
80
|
|
55
|
-
|
81
|
+
yield return new WaitForSeconds(startWait);
|
82
|
+
|
83
|
+
|
56
84
|
|
57
85
|
AttackSequence(1);
|
58
86
|
|
59
|
-
//2秒待つ
|
60
|
-
|
61
87
|
yield return new WaitForSeconds(2f);
|
62
88
|
|
63
89
|
|
@@ -66,32 +92,110 @@
|
|
66
92
|
|
67
93
|
yield return new WaitForSeconds(2f);
|
68
94
|
|
95
|
+
|
96
|
+
|
97
|
+
AttackSequence(3);
|
98
|
+
|
99
|
+
yield return new WaitForSeconds(2f);
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
AttackSequence(4);
|
104
|
+
|
105
|
+
yield return new WaitForSeconds(2f);
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
AttackSequence(5);
|
110
|
+
|
111
|
+
yield return new WaitForSeconds(2f);
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
AttackSequence(6);
|
116
|
+
|
117
|
+
yield break;
|
118
|
+
|
69
119
|
}
|
70
120
|
|
71
121
|
|
72
122
|
|
73
|
-
public Sequence AttackSequence()
|
123
|
+
public Sequence AttackSequence(int num)
|
74
|
-
|
124
|
+
|
75
|
-
{
|
125
|
+
{
|
76
126
|
|
77
127
|
Sequence seq = DOTween.Sequence();
|
78
128
|
|
79
129
|
barrage_1 = this.gameObject.GetComponent<barrage_1>();
|
80
130
|
|
131
|
+
|
132
|
+
|
81
|
-
|
133
|
+
Vector3 aP = new Vector3(0,0,0);
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
if (num == 1)
|
138
|
+
|
139
|
+
{
|
140
|
+
|
141
|
+
aP = aP1;
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
else if(num == 2)
|
146
|
+
|
147
|
+
{
|
148
|
+
|
149
|
+
aP = aP2;
|
150
|
+
|
151
|
+
}
|
152
|
+
|
153
|
+
else if (num == 3)
|
154
|
+
|
155
|
+
{
|
156
|
+
|
157
|
+
aP = aP3;
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
else if (num == 4)
|
162
|
+
|
163
|
+
{
|
164
|
+
|
165
|
+
aP = aP4;
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
else if (num == 5)
|
170
|
+
|
171
|
+
{
|
172
|
+
|
173
|
+
aP = aP5;
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
else if (num == 6)
|
178
|
+
|
179
|
+
{
|
180
|
+
|
181
|
+
aP = aP6;
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
//下に移動
|
82
186
|
|
83
187
|
seq.Append(transform.DOMove(aP, 2f).SetEase(Ease.OutCubic).OnComplete(() =>
|
84
188
|
|
85
189
|
{
|
86
190
|
|
87
|
-
// コルーチン開始
|
191
|
+
// コルーチン開始
|
192
|
+
|
193
|
+
//シーケンス後に呼び出しにしないと、AttackSequence();が実行された後すぐに実行されてしまい、到着前に発動してしまう
|
88
194
|
|
89
195
|
m_Coroutine = barrage_1.Generate(prefab, count, center, distance, distance2, isLookAtCenter);
|
90
196
|
|
91
197
|
barrage_1.StartCoroutine(m_Coroutine);
|
92
198
|
|
93
|
-
|
94
|
-
|
95
199
|
}));
|
96
200
|
|
97
201
|
|