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); }
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; } }
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); }
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); }
public void EquiparObjeto(Assets.Objeto objeto) { DesequiparObjeto(); actualObjetoEquipado = Instantiate(objeto.objetoEquipado, objetoEquipado).GetComponent <Objeto.Camara>(); }
public void LanzarObjeto(Assets.Objeto objeto) { Instantiate(objeto.prefab, posicionSoltarObjeto.position, Quaternion.Euler(Vector3.one * Random.value * 360.0f)); }