- 最后登录
- 2017-6-30
- 注册时间
- 2012-12-27
- 阅读权限
- 90
- 积分
- 10267
- 纳金币
- 6520
- 精华
- 14
|
using UnityEngine;
using System.Collections;
public class change : MonoBehaviour
{
public Texture[] picture;
public int i = 0;
public float waitTime = 2;
private float currentTime = 0;
void Start()
{
i = 0;
gameObject.renderer.material.mainTexture = picture;
currentTime = Time.time;
}
// Update is called once per frame
void Update()
{
if (Time.time > (currentTime + waitTime))
{
if (i < (picture.Length -1))
{
i++;
}
else
{
i = 0;
}
currentTime = Time.time;
}
gameObject.renderer.material.mainTexture = picture;
}
void OnGUI()
{
if (GUILayout.Button("Next"))
{
currentTime = Time.time;
if (i < (picture.Length - 1))
{
i++;
}
else
{
i = 0;
}
}
}
} |
|