示例#1
0
        public void AñadirObjeto(Assets.Objeto objeto)
        {
            if (objeto.puedeCantidad == true)
            {
                Objetos.Hueco huecoRellenar = ObtenerCantidad(objeto);

                if (huecoRellenar != null)
                {
                    huecoRellenar.cantidad += 1;
                    ActualizarInterfaz();
                    return;
                }
            }

            //------------------------

            Objetos.Hueco huecoLibre = ObtenerHuecoVacio();

            if (huecoLibre != null)
            {
                huecoLibre.objeto   = objeto;
                huecoLibre.cantidad = 1;
                ActualizarInterfaz();
                return;
            }

            //------------------------

            LanzarObjeto(objeto);
        }
示例#2
0
        public void QuitarObjeto(Assets.Objeto objeto)
        {
            int i = 0;

            while (i < huecos.Length)
            {
                if (huecos[i].objeto == objeto)
                {
                    huecos[i].cantidad = huecos[i].cantidad - 1;

                    if (huecos[i].cantidad == 0)
                    {
                        if (Canvas.Inventario.instancia.huecos[i].equipado == true)
                        {
                            Desequipar(i);
                        }

                        huecos[i].objeto = null;
                        LimpiarObjetoSeleccionado();
                    }

                    ActualizarInterfaz();
                    return;
                }

                i += 1;
            }
        }
示例#3
0
        public Objetos.Hueco ObtenerCantidad(Assets.Objeto objeto)
        {
            int i = 0;

            while (i < huecos.Length)
            {
                if (huecos[i].objeto == objeto && huecos[i].cantidad < objeto.cantidadMaxima)
                {
                    return(huecos[i]);
                }

                i += 1;
            }

            return(null);
        }
示例#4
0
        public bool TieneObjetos(Assets.Objeto objeto, int cantidad)
        {
            int cantidadTemp = 0;

            int i = 0;

            while (i < huecos.Length)
            {
                if (huecos[i].objeto == objeto)
                {
                    cantidadTemp = cantidadTemp + huecos[i].cantidad;
                }

                if (cantidadTemp >= cantidad)
                {
                    return(true);
                }

                i += 1;
            }

            return(false);
        }
示例#5
0
 public void EquiparObjeto(Assets.Objeto objeto)
 {
     DesequiparObjeto();
     actualObjetoEquipado = Instantiate(objeto.objetoEquipado, objetoEquipado).GetComponent <Objeto.Camara>();
 }
示例#6
0
 public void LanzarObjeto(Assets.Objeto objeto)
 {
     Instantiate(objeto.prefab, posicionSoltarObjeto.position, Quaternion.Euler(Vector3.one * Random.value * 360.0f));
 }