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.

37 lines
688 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class BallController : MonoBehaviour
  5. {
  6. public int HorseCount;
  7. public float size;
  8. public GameObject horsePrefab;
  9. // Start is called before the first frame update
  10. void Start()
  11. {
  12. SpawnHorses();
  13. }
  14. // Update is called once per frame
  15. void Update()
  16. {
  17. }
  18. public void SpawnHorses()
  19. {
  20. for (int i = 0; i < HorseCount; i++)
  21. {
  22. Vector3 position = Random.onUnitSphere * size + transform.position;
  23. Instantiate(horsePrefab, position,Random.rotation , transform);
  24. }
  25. }
  26. }