duck

duck

May 24th, 2010
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function Start () {
  3.  
  4.     yield WaitForSeconds(1.0);
  5.    
  6.     yield DoFunctionForTime( FunctionA, 1.0 );
  7.    
  8.     yield DoFunctionForTime( FunctionB, 1.0 );
  9.    
  10. }
  11.  
  12. function FunctionA() {
  13.     Debug.Log("Function A!");
  14. }
  15.  
  16. function FunctionB() {
  17.     Debug.Log("Function B!");
  18. }
  19.  
  20. function DoFunctionForTime(delegateFunction, time : float) : IEnumerator
  21. {
  22.     var finishTime = Time.time + time;
  23.     while (Time.time < finishTime)
  24.     {
  25.         delegateFunction();
  26.         yield;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment