コード例 #1
0
    void Instanciar(PoolDeObjetos Tipo)
    {
        GameObject Instancia = FuncionesGenerales.InstanciarObjetoDelPool(this.transform.position, Quaternion.identity, Tipo);

        Instancia.SetActive(true);
        this.gameObject.SetActive(false);
    }
コード例 #2
0
ファイル: Enemigos.cs プロジェクト: ferchofreire/invader-demo
    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> ();
    }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 void Start()
 {
     Marcas    = GameObject.Find("Rotos").transform.GetComponent <PoolDeObjetos> ();
     Explocion = GameObject.Find("Explosiones").transform.GetComponent <PoolDeObjetos> ();
 }