test
This commit is contained in:
25
My project/Assets/Script/MeteorRain.cs
Normal file
25
My project/Assets/Script/MeteorRain.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user