Skip to content

Instantly share code, notes, and snippets.

@chabiribon
Created January 20, 2015 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chabiribon/2054f461d4986712712d to your computer and use it in GitHub Desktop.
Save chabiribon/2054f461d4986712712d to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class EnemyBorn : MonoBehaviour {
public GameObject EnemyPrefab;
public float Timer = 6;
public float Xposition = 5;
public float Yposition = 2;
// Use this for initialization
void Start () {
StartCoroutine(Loop(Timer));
}
// Update is called once per frame
private IEnumerator Loop (float time) {
while (true){
yield return new WaitForSeconds(time);
Instantiate(EnemyPrefab,new Vector2(Xposition,Yposition),Quaternion.identity);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment