25 lines
612 B
C#
25 lines
612 B
C#
using System.Collections;
|
|
using UnityEngine;
|
|
using static UnityEngine.UIElements.UxmlAttributeDescription;
|
|
|
|
public class MeteorRain : MonoBehaviour
|
|
{
|
|
|
|
[SerializeField] private GameObject Meteorite;
|
|
|
|
IEnumerator Start()
|
|
{
|
|
while (true)
|
|
{
|
|
yield return new WaitForSeconds(3f);
|
|
Create();
|
|
}
|
|
}
|
|
|
|
void Create()
|
|
{
|
|
GameObject meteor = Instantiate(Meteorite, transform.position, transform.rotation);
|
|
meteor.GetComponent<Rigidbody>().linearVelocity =
|
|
new Vector3(Random.Range(-10.0f, 10.0f), Random.Range(-10.0f, 0f), 0);
|
|
}
|
|
} |