コード例 #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (HasBags())
     {
         if (other.gameObject.CompareTag("Deposito"))
         {
             Deposito2 dep = GetComponent <Deposito2>();
             cd.Activar(dep);
         }
     }
 }
コード例 #2
0
    //--------------------------------------------------------------//

    public void Activar(Deposito2 d)
    {
        Dep = d;                                      //recibe el deposito para que sepa cuando dejarlo ir al camion
        CamaraConduccion.SetActiveRecursively(false); //apaga la camara de conduccion
        //activa los componentes
        for (int i = 0; i < Componentes.Length; i++)
        {
            Componentes[i].SetActiveRecursively(true);
        }


        CollCamion.enabled = false;
        Pj.CambiarADescarga();


        GameObject go;

        //asigna los pallets a las estanterias
        palletMover.ResetUI();

        for (int i = 0; i < Pj.Bolasas.Length; i++)
        {
            if (Pj.Bolasas[i] != null)
            {
                Contador++;

                switch (Pj.Bolasas[i].Monto)
                {
                case Pallet.Valores.Valor1:
                    go = (GameObject)Instantiate(Pallet1);
                    Est1.Recibir(go.GetComponent <Pallet>());
                    break;

                case Pallet.Valores.Valor2:
                    go = (GameObject)Instantiate(Pallet2);
                    Est2.Recibir(go.GetComponent <Pallet>());
                    break;

                case Pallet.Valores.Valor3:
                    go = (GameObject)Instantiate(Pallet3);
                    Est3.Recibir(go.GetComponent <Pallet>());
                    break;
                }
            }
        }
        //animacion
        ObjAnimado.Entrar();
    }
コード例 #3
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == TagDeposito)
     {
         Deposito2 dep = other.GetComponent <Deposito2>();
         if (dep.Vacio)
         {
             if (this.GetComponent <Player>().ConBolasas())
             {
                 dep.Entrar(this.GetComponent <Player>());
                 Destino           = other.transform.position;
                 transform.forward = Destino - transform.position;
                 Frenar();
             }
         }
     }
 }