using System.Collections; using System.Collections.Generic; using UnityEngine; public class Rakka : MonoBehaviour { [SerializeField] private Ball[] _prefabs; private int _count=0; void Start() { _loop(); } private void _loop(){ int index = Mathf.FloorToInt(_prefabs.Length*Random.value); var b = Instantiate(_prefabs[index],transform,false); b.transform.localPosition = transform.localPosition + new Vector3(0.4f*(Random.value-0.5f),00.4f*(Random.value-0.5f)); b.transform.localScale = Vector3.one*(0.5f+2f*Random.value); if(index==1){ b.transform.localScale = new Vector3( 0.5f+2f*Random.value, 0.5f+2f*Random.value, 0.5f+2f*Random.value ); } b.transform.localRotation = Quaternion.Euler(360f*Random.value,360f*Random.value,360f*Random.value); b.Init(); b.gameObject.SetActive(true); Invoke("_loop",1f); } }