SebastianLague

Base Class (thomas)

Apr 3rd, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class BaseClass : MonoBehaviour {
  5.  
  6.     public void MyInvoke(System.Action method, float delay) {
  7.         StartCoroutine (StartMethodWithDelay (method, delay));
  8.     }
  9.  
  10.     IEnumerator StartMethodWithDelay(System.Action method, float delay) {
  11.         yield return new WaitForSeconds (delay); method ();
  12.     }
  13.  
  14.     public void MyInvoke(System.Action<int> method, int parameter, float delay) {
  15.         StartCoroutine (StartMethodWithDelay (method, parameter, delay));
  16.     }
  17.  
  18.     IEnumerator StartMethodWithDelay(System.Action<int> method, int parameter, float delay) {
  19.         yield return new WaitForSeconds (delay); method (parameter);
  20.     }
  21.  
  22. }
Add Comment
Please, Sign In to add comment