- 最后登录
- 2019-12-2
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 34660
![Rank: 7](static/image/common//star_level3.gif) ![Rank: 7](static/image/common//star_level2.gif) ![Rank: 7](static/image/common//star_level1.gif)
- 纳金币
- 38276
- 精华
- 111
|
代码如下:- 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);
- }
- }
复制代码 |
|