Unity3d漸隱效果
來源:
未知 |
責任編輯:陳玉泳 |
發(fā)布時間: 2013-07-03 15:54 | 瀏覽量:
Unity3d實現(xiàn)漸隱效果的部分代碼,納米們可參考一下,希望對大家有幫助:
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);
}
}
-
分享到:
相關(guān)文章
網(wǎng)友評論
全部評論:0條
推薦
熱門