private void DropInventoryUnit() { if (inventoryHover.isHolding) { TakeUnitFromInventory(inventoryHover.heldObject.GetComponent <InventCharButton>()); inventoryHover.DropIt(); } inventoryManager.AddCard(heldUnit.instanceNumber); Destroy(heldUnit.gameObject); holdingUnit = false; heldUnit = null; }
// Method called whenever the mouse clicks public void OnPointerClick(PointerEventData eventData) { if (dm.drawCount > 0 && !opened) { opened = true; // Destroys the specified gameobject (in this case, the gameobject on top of the card to reveal what's under it) Destroy(transform.GetChild(1).gameObject); // creates a separate process (thread?) for the specified method StartCoroutine(PlayCardAnimation()); // let the RoomManager know that a card was removed rm.RemoveCard(cardType); // let the DrawManager know that a draw count was used dm.RemoveDrawCount(); // let InventoryManager know that a card was added im.AddCard(cardType); } }