Created
January 20, 2015 12:54
-
-
Save chabiribon/2054f461d4986712712d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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