using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CreatWolfs : MonoBehaviour
{
//设计创造敌人的时间
private float CreatTime = 5f;
//敌人
public GameObject Wolfs;
void Update()
{
CreatTime -= Time.deltaTime; //开始倒计时
if (CreatTime <= 0) //如果倒计时为0 的时候
{
//随机3到9秒内
CreatTime = Random.Range(3, 10);
//加载预制体到内存
GameObject obj = (GameObject)Resources.Load("Prefabs/WolfNormal");
//实例化敌人
Wolfs = Instantiate<GameObject>(obj);
//随机生成狼的位置
Wolfs.transform.position = new Vector3(Random.Range(408f, 77f), 21f, Random.Range(87f, 397f));
}
}
}