Created
January 30, 2015 04:48
-
-
Save chabiribon/2a61b7462c621844247f 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 Generation : MonoBehaviour { | |
public GameObject Prefab1; | |
public GameObject Prefab2; | |
public GameObject Prefab3; | |
public GameObject Prefab4; | |
public GameObject Prefab5; | |
public float Timer = 1; | |
public float Xposition = 0; | |
public float Yposition = 6; | |
public float areaA = 0.0f; | |
public float areaB = 4.0f; | |
// Use this for initialization | |
void Start () { | |
StartCoroutine(Loop(Timer)); | |
} | |
// Update is called once per frame | |
void Update () { | |
} | |
// Update is called once per frame | |
private IEnumerator Loop (float time) { | |
while (true){ | |
yield return new WaitForSeconds(Timer); | |
float area = Random.Range(areaA,areaB); | |
int seisuu = Random.Range(0,5); | |
var array = new []{Prefab1,Prefab2,Prefab3,Prefab4,Prefab5}; | |
Instantiate(array[seisuu],new Vector2(area,Yposition),Quaternion.identity); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment