質問編集履歴
1
変数名を修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -152,7 +152,7 @@
|
|
152
152
|
|
153
153
|
|
154
154
|
|
155
|
-
public class
|
155
|
+
public class BallController : MonoBehaviour
|
156
156
|
|
157
157
|
{
|
158
158
|
|
@@ -204,15 +204,15 @@
|
|
204
204
|
|
205
205
|
|
206
206
|
|
207
|
-
public class
|
207
|
+
public class BallGenerator : MonoBehaviour
|
208
|
-
|
208
|
+
|
209
|
-
{
|
209
|
+
{
|
210
|
-
|
210
|
+
|
211
|
-
public GameObject
|
211
|
+
public GameObject ballPrefab;
|
212
|
-
|
212
|
+
|
213
|
-
private GameObject _
|
213
|
+
private GameObject _ball;
|
214
|
-
|
214
|
+
|
215
|
-
private
|
215
|
+
private BallController _ballController;
|
216
216
|
|
217
217
|
|
218
218
|
|
@@ -224,9 +224,9 @@
|
|
224
224
|
|
225
225
|
// ここでInstantiateを使うと、クリック前にオブジェクトが生成されてしまう。
|
226
226
|
|
227
|
-
// _
|
227
|
+
// _ball = Instantiate(ballPrefab) as GameObject;
|
228
|
-
|
228
|
+
|
229
|
-
// _
|
229
|
+
// _ballController = _ball.GetComponent<BallController>();
|
230
230
|
|
231
231
|
}
|
232
232
|
|
@@ -242,9 +242,9 @@
|
|
242
242
|
|
243
243
|
if (Input.GetMouseButton(0)) {
|
244
244
|
|
245
|
-
_
|
245
|
+
_ball = Instantiate(ballPrefab) as GameObject;
|
246
|
-
|
246
|
+
|
247
|
-
_
|
247
|
+
_ball.GetComponent<BallController>().Shoot(new Vector3(0, 200, 2000));
|
248
248
|
|
249
249
|
}
|
250
250
|
|