using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Barrage : MonoBehaviour
{
private GameObject obj;
private GameObject objeff;
public float Hight_Y = 5.0f;//高度
public float Forward_Z = 0f;//深度
// Use this for initialization
void Start()
{
obj = Resources.Load<GameObject>("Prefabs/Cube");//获取文件夹下的预制体Cu
Debug.Log(obj.name);
}
// Update is called once per frame
void Update()
{
Vector3 asteroidPos = new Vector3(Random.Range(transform.position.x, 0f/*-transform.position.x*/), Hight_Y, Forward_Z);//预制体生成坐标(跟随X轴移动)
objeff = Instantiate(obj, asteroidPos, transform.rotation);//实例化预制体
}
}