VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > Python基础教程 >
  • C#教程之C#应该掌握的一些东西(2)

    }

}

using UnityEngine;using System.Collections;

public class example : MonoBehaviour {

    void Start() {

    print("Starting " + Time.time);

        StartCoroutine(WaitAndPrint(2.0F));

        print("Before WaitAndPrint Finishes " + Time.time);

    }

    IEnumerator WaitAndPrint(float waitTime) {

        yield return new WaitForSeconds(waitTime);

        print("WaitAndPrint " + Time.time);

    }

}

using UnityEngine;using System.Collections;

public class example : MonoBehaviour {

    IEnumerator Do() {

        print("Do now");

        yield return new WaitForSeconds(2);

        print("Do 2 seconds later");

    }

    IEnumerator Awake() {

        yield return StartCoroutine("Do");    //Yield StartCoroutine就代表中断式的协同工作

        print("Also after 2 seconds");

        print("This is after the Do coroutine has finished execution");

    }

}

using UnityEngine;using System.Collections;

public class example : MonoBehaviour {public static IEnumerator Do() {

  print("Do now");

  yield return new WaitForSeconds(2);

  print("Do 2 seconds later");

}void Awake() {

  Do();    //执行DO,但是do后的语句继续执行

  print("This is printed immediately");

}


相关教程