void OnTriggerEnter(Collider colliderSarah) { objetivoTrigger = GameObject.Find("Button").GetComponent <Click>().GetObjetivoTrigger(); if (gameObject == objetivoTrigger) { if (colliderSarah.CompareTag("Player")) { if (texto != null) { texto.text = GetComponent <Objetos>().GetDescripcion(); } activarDescripcion.SetActive(true); if (gameObject.tag == "Objeto") { StartCoroutine(_CerrarDocumento()); } if (gameObject.GetComponent <CursorType>().GetCursorType() == CursorType.Type.coger) { addObject = objetivoTrigger.GetComponent <ItemPrueba>(); GameObject.Find("Inventario").GetComponent <Inventory>().AddItem(addObject); gameObject.GetComponent <MeshRenderer>().enabled = false; gameObject.GetComponent <Collider>().enabled = false; } } } }
public void AddDocument(ItemPrueba documentToAdd) { for (int i = 0; i < documents.Length; i++) { if (documents[i] == null) { documents[i] = documentToAdd; texts[i].text = documentToAdd.GetString(); return; } } }
public void RemoveItem(ItemPrueba itemToRemove) { for (int i = 0; i < items.Length; i++) { if (items[i] == itemToRemove) { items[i] = null; itemImages[i].sprite = null; itemImages[i].enabled = false; return; } } }
public void RemoveDocument(ItemPrueba documentToRemove) { for (int i = 0; i < documents.Length; i++) { if (documents[i] == documentToRemove) { documents[i] = null; texts[i].text = null; return; } } }
public void AddItem(ItemPrueba itemToAdd) { for (int i = 0; i < items.Length; i++) { if (items[i] == null) { items[i] = itemToAdd; itemImages[i].sprite = itemToAdd.GetSprite(); color = itemImages [i].color; color.a = 1; itemImages [i].color = color; itemImages[i].enabled = true; return; } } }