纳金网
标题:
Unity3d渐隐效果
[打印本页]
作者:
tianhett
时间:
2015-2-13 00:32
标题:
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);
}
}
欢迎光临 纳金网 (http://go.narkii.com/club/)
Powered by Discuz! X2.5