敵ロボットの製造装置を作る



敵を生み出す(コルーチン)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyGene : MonoBehaviour
{
public GameObject enemyPrefab;
void Start()
{
StartCoroutine(BotGene());
}
// コルーチンの活用
private IEnumerator BotGene()
{
yield return new WaitForSeconds(2f);
for (int i = 0; i < 5; i++)
{
Instantiate(enemyPrefab, transform.position, transform.rotation);
yield return new WaitForSeconds(1);
}
}
}






敵を生み出す(コルーチン)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyGene : MonoBehaviour
{
public GameObject enemyPrefab;
void Start()
{
StartCoroutine(BotGene());
}
// コルーチンの活用
private IEnumerator BotGene()
{
yield return new WaitForSeconds(2f);
for (int i = 0; i < 5; i++)
{
Instantiate(enemyPrefab, transform.position, transform.rotation);
yield return new WaitForSeconds(1);
}
}
}



敵ロボットの製造装置を作る