34 lines
698 B
C#
Raw Normal View History

2025-01-17 13:10:20 +01:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MeteorRain : MonoBehaviour
{
[SerializeField] private GameObject Meteor;
// Start is called before the first frame update
IEnumerator Start()
{
while (true)
{
yield return new WaitForSeconds(1.5f);
Create();
}
}
// Update is called once per frame
void Update()
{
}
void Create()
{
GameObject ball = Instantiate(Meteor, transform.position, transform.rotation);
ball.GetComponent<Rigidbody>().velocity = new Vector3(Random.Range(-5.0f, 5.0f), Random.Range(-5.0f, 0f), 0);
}
}