等待时间脚本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CeLiangYi : MonoBehaviour {
public GameObject CeLiangYi_Button; //测量仪开关
public ModelXianShi xianShi;
public void OnClickCeLiangYi()
{
if (xianShi.Modle01[1] != null)
{
xianShi.Modle01[1].SetActive(true); //标注线出现
}
//等待三秒标注线消失,木桩和细线出现
StartCoroutine(WaitEvent(3.0f)); // 括号中的数字就是等待的时间,按秒算
}
IEnumerator WaitEvent(float waitTime)
{
yield return new WaitForSeconds(waitTime);
//木桩出现的方法
if (xianShi.Modle01[2] != null)
{
xianShi.Modle01[2].SetActive(true); //木桩细线线出现
}
}
using System.Collections.Generic;
using UnityEngine;
public class CeLiangYi : MonoBehaviour {
public GameObject CeLiangYi_Button; //测量仪开关
public ModelXianShi xianShi;
public void OnClickCeLiangYi()
{
if (xianShi.Modle01[1] != null)
{
xianShi.Modle01[1].SetActive(true); //标注线出现
}
//等待三秒标注线消失,木桩和细线出现
StartCoroutine(WaitEvent(3.0f)); // 括号中的数字就是等待的时间,按秒算
}
IEnumerator WaitEvent(float waitTime)
{
yield return new WaitForSeconds(waitTime);
//木桩出现的方法
if (xianShi.Modle01[2] != null)
{
xianShi.Modle01[2].SetActive(true); //木桩细线线出现
}
}
}