Ejemplo n.º 1
0
    //--------------------------------------------------------------//
    public void Activar(Deposit2 d)
    {
        Dep = d;                           //recibe el deposito para que sepa cuando dejarlo ir al camion
        CamaraConduccion.SetActive(false); //apaga la camara de conduccion

        //activa los componentes
        for (int i = 0; i < Componentes.Length; i++)
        {
            Componentes[i].SetActive(true);
        }


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


        GameObject go;

        //asigna los pallets a las estanterias
        for (int i = 0; i < Pj.Bags.Length; i++)
        {
            if (Pj.Bags[i] != null)
            {
                Contador++;

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

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

                case Pallet.Valores.Valor3:
                    go = Instantiate(Pallet3);
                    Est3.Recibir(go.GetComponent <Pallet>());
                    break;
                }
            }
        }

        //animacion
        ObjAnimado.Entrar();
    }
Ejemplo n.º 2
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == DepositTag)
     {
         Deposit2 deposit = other.GetComponent <Deposit2>();
         if (deposit.empty)
         {
             if (GetComponent <Player>().ConBolsas())
             {
                 deposit.Entrar(GetComponent <Player>());
                 Destino           = other.transform.position;
                 transform.forward = Destino - transform.position;
                 Frenar();
             }
         }
     }
 }