mycj_demo/mycj/Assets/Script/npcInit.cs

49 lines
1.0 KiB
C#
Raw Normal View History

2024-12-02 09:37:47 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class npcInit : MonoBehaviour
{
[Header("Ԥ<><D4A4><EFBFBD><EFBFBD>")]
public GameObject npcPrefab;
[Header("·<><C2B7>")]
public List<Transform> path = new List<Transform>();
[Header("<22><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>")]
public float moveNeedTimer;
// Start is called before the first frame update
void Start()
{
Penal.instance.Daojishi(5f);
StartCoroutine(getmouse());
}
// Update is called once per frame
void Update()
{
}
void GetMouse()
{
GameObject go = Instantiate(npcPrefab, this.transform);
go.transform.position = path[0].transform.position;
go.GetComponent<npcMove>().Init(path, moveNeedTimer);
}
IEnumerator getmouse()
{
yield return new WaitForSeconds(5f);
int index = 0;
while (index<=4)
{
GetMouse();
index++;
yield return new WaitForSeconds(3f);
}
}
}