纳金网

标题: 一个幻灯效果代码。。看不太懂 [打印本页]

作者: 雅雅    时间: 2013-6-29 20:34
标题: 一个幻灯效果代码。。看不太懂
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;
}
}
}
}
作者: ku    时间: 2013-6-29 21:32
你都两个太阳了,你还装看不懂???
作者: 雅雅    时间: 2013-6-29 22:05
我还见过三个太阳的啊,,不是程序背景




欢迎光临 纳金网 (http://rs.narkii.com/club/) Powered by Discuz! X2.5