2022-04-27 19:12:09 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class spawner : MonoBehaviour
|
|
|
|
{
|
|
|
|
//get enemy and king prefab
|
|
|
|
public GameObject enemy;
|
|
|
|
public GameObject king;
|
2022-04-28 19:51:32 +02:00
|
|
|
public int numkings = 16;
|
|
|
|
public int numenemies = 90;
|
2022-04-27 19:12:09 +02:00
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
//spawn enemies
|
|
|
|
for (int i = 0; i < numenemies; i++)
|
|
|
|
{
|
|
|
|
//spawn enemy
|
2022-04-28 19:13:46 +02:00
|
|
|
GameObject enemyclone = Instantiate(enemy, new Vector3(Random.Range(10, 125), Random.Range(-70, -60), Random.Range(-100, -10)), Quaternion.identity);
|
2022-04-27 19:12:09 +02:00
|
|
|
//set enemy name
|
|
|
|
enemyclone.name = "enemy" + i;
|
|
|
|
enemyclone.tag = "enemy";
|
|
|
|
}
|
|
|
|
//spawn kings
|
|
|
|
for (int i = 0; i < numkings; i++)
|
|
|
|
{
|
|
|
|
//spawn king
|
2022-04-28 19:13:46 +02:00
|
|
|
GameObject kingclone = Instantiate(king, new Vector3(Random.Range(10, 125), Random.Range(-70, -60), Random.Range(-100, -10)), Quaternion.identity);
|
2022-04-27 19:12:09 +02:00
|
|
|
//set king name
|
|
|
|
kingclone.name = "king" + i;
|
|
|
|
kingclone.tag = "king";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|