using UnityEngine;
using System.Collections;

public class Spawner : MonoBehaviour {

	public static Spawner instance;

	public GameObject[] patternList;

	public GameObject pedra;

	// Use this for initialization
	void Start () {
		if(instance == null){
			instance = this;
		}
	}
	public void PushPattern(){
		int r = Random.Range (0, patternList.Length);
		GameObject go=null;
		if(r==0){
			go= Instantiate (patternList[r], new Vector3(-4,Random.Range(0.5f,3),0),Quaternion.identity) as GameObject;
		}else if(r==1){
			go= Instantiate (patternList[r], new Vector3(-8,Random.Range(0.5f,3),0),Quaternion.identity) as GameObject;
		}
		MovimentacaoPlataforma[] mv = go.GetComponentsInChildren<MovimentacaoPlataforma> ();
		foreach(MovimentacaoPlataforma m in mv){
			m.velocidade = Random.Range(3,6);
		}

		GameManager.instance.plataforma = go;
	}
	public void PushStone(){
		GameObject goP= Instantiate (pedra, new Vector3(-1.74f,0,0),Quaternion.identity) as GameObject;
		goP.GetComponent<Rigidbody2D> ().isKinematic=true;
	}
}
