纳金网
标题:
Unity3d渐隐效果的代码
[打印本页]
作者:
狂风大尉
时间:
2014-11-26 02:26
标题:
Unity3d渐隐效果的代码
代码如下:
using UnityEngine;
using System.Collections;
public class Dis : MonoBehaviour {
private float AlphaValue = 1;
private float time = 0;
private bool state = false;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
time += Time.deltaTime;
if(time >= 0.2f)
{
state = true;
time = 0;
}
if(state)
{
AlphaValue -= 0.1f;
state = false;
}
if(AlphaValue <= 0)
{
AlphaValue = 1;
}
GameObject.Find("Cube").renderer.material.color = new Color(0.5f,0.3f,1,AlphaValue);
Debug.Log(AlphaValue);
}
}
复制代码
作者:
hyui
时间:
2014-11-26 02:53
good to learn from
code !!
作者:
may
时间:
2014-11-26 07:21
thanks, 不错的介绍
作者:
oelongeo
时间:
2014-11-26 11:22
谢谢指导! 学习了
代码真实用
作者:
Mr.Fair
时间:
2014-11-26 13:34
谢谢指导! 学习了 代码真实用
作者:
seven11235
时间:
2014-11-26 16:02
update里面find,真是醉了····
欢迎光临 纳金网 (http://go.narkii.com/club/)
Powered by Discuz! X2.5