ロボットを生み出す装置を作る
![1be605b4 1420 45a1 a302 65e6905b9b9d](https://codegenius.org/uploads/slide/image/3823/1be605b4-1420-45a1-a302-65e6905b9b9d.jpeg)
![Fd066fcf ac17 4a15 8460 58dab4a4ca5a](https://codegenius.org/uploads/slide/image/3824/fd066fcf-ac17-4a15-8460-58dab4a4ca5a.jpeg)
![651f4260 9c05 4f89 b28c 2bb01df02067](https://codegenius.org/uploads/slide/image/3825/651f4260-9c05-4f89-b28c-2bb01df02067.jpeg)
![3c5dd2b4 e326 4749 a950 8280e9fe62a5](https://codegenius.org/uploads/slide/image/3826/3c5dd2b4-e326-4749-a950-8280e9fe62a5.jpeg)
![474e1a39 9db7 451d b7d1 66c342857767](https://codegenius.org/uploads/slide/image/3827/474e1a39-9db7-451d-b7d1-66c342857767.jpeg)
ロボット製造装置
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BotGene : MonoBehaviour
{
public GameObject botPrefab;
public float startTime;
public float interval;
void Start()
{
// startTimeで設定した時間にBotGeneメソッドを呼び出して、以降、intervalで設定した間隔でリピート実行する。
InvokeRepeating("Gene", startTime, interval);
}
void Gene()
{
Vector3 pos = transform.position;
Instantiate(botPrefab, new Vector3(pos.x, pos.y + 0.25f, pos.z), transform.rotation);
}
}
![95d471bd 4599 495a 804f 3ad39713131d](https://codegenius.org/uploads/slide/image/3828/95d471bd-4599-495a-804f-3ad39713131d.jpeg)
![Aac04d88 1837 4acb af43 7f1b7ca65533](https://codegenius.org/uploads/slide/image/3829/aac04d88-1837-4acb-af43-7f1b7ca65533.jpeg)
![1627662e 70b4 4da3 913e f6b6cbf6f5f6](https://codegenius.org/uploads/slide/image/3830/1627662e-70b4-4da3-913e-f6b6cbf6f5f6.jpeg)
【2019版】TowerD I(基礎/全10回)
1 | 敵ロボットの作成&前進 |
2 | 敵ロボットをターンさせる1 |
3 | 敵ロボットをターンさせる2 |
4 | 敵ロボットにHPをつける |
5 | ロボットを生み出す装置を作る |
6 | マイロボットの作成1 |
7 | マイロボットにライフタイムを設定する |
8 | マイロボットの作成2 |
9 | ★チェックポイント |
10 | ★チャレンジ |
![1be605b4 1420 45a1 a302 65e6905b9b9d](https://codegenius.org/uploads/slide/image/3823/1be605b4-1420-45a1-a302-65e6905b9b9d.jpeg)
![Fd066fcf ac17 4a15 8460 58dab4a4ca5a](https://codegenius.org/uploads/slide/image/3824/fd066fcf-ac17-4a15-8460-58dab4a4ca5a.jpeg)
![651f4260 9c05 4f89 b28c 2bb01df02067](https://codegenius.org/uploads/slide/image/3825/651f4260-9c05-4f89-b28c-2bb01df02067.jpeg)
![3c5dd2b4 e326 4749 a950 8280e9fe62a5](https://codegenius.org/uploads/slide/image/3826/3c5dd2b4-e326-4749-a950-8280e9fe62a5.jpeg)
![474e1a39 9db7 451d b7d1 66c342857767](https://codegenius.org/uploads/slide/image/3827/474e1a39-9db7-451d-b7d1-66c342857767.jpeg)
ロボット製造装置
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BotGene : MonoBehaviour
{
public GameObject botPrefab;
public float startTime;
public float interval;
void Start()
{
// startTimeで設定した時間にBotGeneメソッドを呼び出して、以降、intervalで設定した間隔でリピート実行する。
InvokeRepeating("Gene", startTime, interval);
}
void Gene()
{
Vector3 pos = transform.position;
Instantiate(botPrefab, new Vector3(pos.x, pos.y + 0.25f, pos.z), transform.rotation);
}
}
![95d471bd 4599 495a 804f 3ad39713131d](https://codegenius.org/uploads/slide/image/3828/95d471bd-4599-495a-804f-3ad39713131d.jpeg)
![Aac04d88 1837 4acb af43 7f1b7ca65533](https://codegenius.org/uploads/slide/image/3829/aac04d88-1837-4acb-af43-7f1b7ca65533.jpeg)
![1627662e 70b4 4da3 913e f6b6cbf6f5f6](https://codegenius.org/uploads/slide/image/3830/1627662e-70b4-4da3-913e-f6b6cbf6f5f6.jpeg)
ロボットを生み出す装置を作る