public override void shopActivate(Transform slotTransform) { GameObject inventoryItem = Instantiate(image); inventoryItem.transform.Find("Tip").GetComponent <Image>().sprite = tips[tip]; inventoryItem.transform.Find("Sash").GetComponent <Image>().sprite = sashes[sash]; inventoryItem.transform.Find("Handle").GetComponent <Image>().sprite = handles[handle]; //if (auraType != 0) //{ // //inventoryItem.transform.Find("Aura").GetComponent<Image>().sprite = auras[aura]; //} //else //{ // inventoryItem.transform.Find("Aura").GetComponent<Image>().enabled = false; //} inventoryItem.transform.Find("Aura").GetComponent <Image>().enabled = false; ModularSpear invSpear = inventoryItem.GetComponent <ModularSpear>(); invSpear.additionalDamage = additionalDamage; invSpear.attackSpeedMultiplier = attackSpeedMultiplier; invSpear.description = description; invSpear.itemName = "Spear"; invSpear.value = value; invSpear.auraType = auraType; invSpear.slowDuration = slowDuration; invSpear.freezeDuration = freezeDuration; Instantiate(invSpear, slotTransform); Destroy(inventoryItem); Destroy(gameObject); }
void OnTriggerEnter2D(Collider2D c) { if (inShop) { return; } GameObject other = c.gameObject; if (other.CompareTag("Player")) { Player player = other.GetComponent <Player>(); GameObject inventoryItem = Instantiate(image); inventoryItem.transform.Find("Tip").GetComponent <Image>().sprite = tips[tip]; inventoryItem.transform.Find("Sash").GetComponent <Image>().sprite = sashes[sash]; inventoryItem.transform.Find("Handle").GetComponent <Image>().sprite = handles[handle]; if (auraType != 0) { inventoryItem.transform.Find("Aura").GetComponent <Image>().sprite = auras[aura]; } else { inventoryItem.transform.Find("Aura").GetComponent <Image>().enabled = false; } ModularSpear invSpear = inventoryItem.GetComponent <ModularSpear>(); invSpear.inInventory = true; invSpear.additionalDamage = additionalDamage; invSpear.attackSpeedMultiplier = attackSpeedMultiplier; invSpear.description = description; invSpear.itemName = "Spear"; invSpear.value = value; invSpear.auraType = auraType; invSpear.slowDuration = slowDuration; invSpear.freezeDuration = freezeDuration; inv.AddItem(invSpear); Destroy(inventoryItem); Destroy(gameObject); } }