36 lines
870 B
C#
36 lines
870 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Resurrection : MonoBehaviour
|
|
{
|
|
|
|
public List<GameObject> re = new List<GameObject>();//使用list存储复活点位置
|
|
|
|
private GameObject ga;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
ga =(GameObject)Resources.Load("Character/Vang");//从resousce资源中加载npc
|
|
Init();
|
|
}
|
|
|
|
private void Init()
|
|
{
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
GameObject instance = (GameObject)Instantiate(ga);//实例化npc
|
|
int a = Random.Range(0, 5);//用随机数保证出生位置的随机性
|
|
Vector3 va = re[a].transform.position; //创建局部变量用来保存出生点的位置信息
|
|
instance.transform.position = va;
|
|
}
|
|
}
|
|
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|