using UnityEngine;
using System.Collections;
public class cubeClick : MonoBehaviour {
public GameObject _camera;
public Texture[] Pic;
private int indexOfPic =0;
private float currentTime;
private float endTime;
public bool _switch = false;
// Use this for initialization
void Start () {
currentTime = Time.time;
guiTexture.enabled =false;
}
// Update is called once per frame
void Update () {
if (_switch){
guiTexture.enabled = true;
}
endTime = Time.time;//每刷新一帧画面就获取一下当前时间,
var timeOffset =endTime - currentTime;
if (timeOffset>1) {//每隔一秒切换一下图片
if (indexOfPic
guiTexture.texture = Pic[indexOfPic];
indexOfPic++;
}else {
indexOfPic = 0;
guiTexture.texture = Pic[indexOfPic];
}
currentTime = Time.time;//切换了一张图片之后,就获取新的时间点
}
}
}