void Instanciar(PoolDeObjetos Tipo) { GameObject Instancia = FuncionesGenerales.InstanciarObjetoDelPool(this.transform.position, Quaternion.identity, Tipo); Instancia.SetActive(true); this.gameObject.SetActive(false); }
void OnEnable() { float rand_tiempo = Random.Range(2.0f, 8.05f); InvokeRepeating("Disparo", rand_tiempo, 4.0f); Balas = GameObject.Find("BalasEnemigos").transform.GetComponent <PoolDeObjetos> (); Explosion = GameObject.Find("Explosiones").transform.GetComponent <PoolDeObjetos> (); }
public static GameObject InstanciarObjetoDelPool(Vector3 Posicion, Quaternion Rotacion, PoolDeObjetos Pool) { if (Pool.gameObject != null) { GameObject ObjetoObtenido = Pool.CargarObjetoDeMemoria(); if (ObjetoObtenido != null) { ObjetoObtenido.transform.position = Posicion; ObjetoObtenido.transform.rotation = Rotacion; // ObjetoObtenido.gameObject.SetActive (true); return(ObjetoObtenido); } else { return(null); } } else { return(null); } }
void Start() { Marcas = GameObject.Find("Rotos").transform.GetComponent <PoolDeObjetos> (); Explocion = GameObject.Find("Explosiones").transform.GetComponent <PoolDeObjetos> (); }