Global Game Jam 2021
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
656 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class spawner : MonoBehaviour
  5. {
  6. public GameObject childPrefab;
  7. public float spawnTime;
  8. private float timer = 0;
  9. public int startingAmount = 100;
  10. void Start()
  11. {
  12. for (int x = 0; x < startingAmount; x++)
  13. {
  14. SpawnBaby();
  15. }
  16. }
  17. public void SpawnBaby()
  18. {
  19. float _x = Random.Range(-45, 45);
  20. float _z = Random.Range(-35, 35);
  21. var _newChild = Instantiate(childPrefab, new Vector3(_x, 1.5f, _z), Quaternion.identity);
  22. _newChild.transform.parent = this.transform;
  23. }
  24. }