- 最后登录
- 2020-3-16
- 注册时间
- 2014-4-17
- 阅读权限
- 90
- 积分
- 7683
- 纳金币
- 2378
- 精华
- 0
|
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);
}
}
|
|