美文网首页
Unity 最简单的携程

Unity 最简单的携程

作者: psmyfish | 来源:发表于2020-09-07 15:11 被阅读0次
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class IEnumeratorTest : MonoBehaviour {
 
    public float delayedSeconds = 2.3f;
 
    private void Start()
    {
        Material mat = GetComponent().material;
        StartCoroutine(Fade(mat));
        StartCoroutine(DelayedDestroy());
    }
 
    IEnumerator DelayedDestroy()
    {
        Debug.Log(string.Format("GameObject will be destroyed in {0} seconds.", delayedSeconds));
        yield return new WaitForSeconds(delayedSeconds);
        Destroy(this.gameObject);
    }
 
    IEnumerator Fade(Material mat)
    {
        Color col = mat.color;
        while (col.a > 0f)
        {
            col.a -= 0.01f;
            mat.color = col;
            yield return null;
        }
    }
}

相关文章

  • Unity 最简单的携程

  • 携程在手,退款没门

    携程在手,退款没门 ❝携程是我见过最恶心的公司,没有之一,请大家引以为戒,本人发誓此次事件之后,终身不使用携程,以...

  • 携程告诉你安不安全该用还得用

    携程挂了,据我所知这已经不是第一次了,但是确是最严重的一次,数据安全真的靠谱么。反正携程的数据是真的不安全。携程在...

  • Unity教程之-不创建GameObject也能使用协程Coro

    在unity3d中我们知道如果要想启动一个携程Coroutine,必须创建一个Gameobject或者脚本需继承自...

  • XLua里使用协程

    在XLua里如何使用协程?有两种方式 使用Unity协程要想通过unity的StartCoroutine使用协程,...

  • Unity3D协程介绍

    协程介绍 Unity的协程系统是基于C#的一个简单而强大的接口,IEnumerator,它允许你为自己的集合...

  • 携程

    一.国内行业现状 随着人民生活水平不断提高以及现如今处于信息爆炸社会,在线旅游市场一直较为火爆,但具艾瑞数据表示:...

  • 携程

    第二年与儿子一起出行 仍然延用购票工具携程 然一年之内携程已不诚 无端加价还要牛的不行 动不动无票但用抢加成 索性...

  • 酒店人您在不了解携程SEO就out了

    一、什么是携程SEO 携程SEO全称为“携程搜索引擎优化”,是指按照携程搜索引擎的规则,来设置优化酒店,从而使得酒...

  • Unity3D 协程管理

    Unity里面的协程好用,但总是在如何关闭指定协程,尤其是关闭带参数的协程的问题上困惑不已。在本文,笔者带你用最简...

网友评论

      本文标题:Unity 最简单的携程

      本文链接:https://www.haomeiwen.com/subject/flflektx.html