void OnPimDroppedItemEvent(Pim pim, Item item) { foreach (Transform child in transform) { Destroy(child.gameObject); } }
void ClearAllHighlightedTiles(Pim pim, Item item) { foreach (GameObject go in highlightEffectCache) { Destroy(go); } highlightEffectCache.Clear(); }
void OnPimPickedUpItemEvent(Pim pim, Item item) { foreach (Transform child in transform) { Destroy(child.gameObject); } LookupRecipesForItem(item.itemType); }
void HighlightInteractableTiles(Pim pim, Item item) { List <GameObject> gos = GameObject.FindGameObjectsWithTag("PickupPoint").ToList <GameObject>(); List <PickupPoint> pickupPoints = new List <PickupPoint>(); foreach (var go in gos) { PickupPoint pickupPoint = go.GetComponent <PickupPoint>(); if (pickupPoint) { pickupPoints.Add(pickupPoint); } } foreach (PickupPoint pickupPoint in pickupPoints) { //if (pickupPoint.CanDropHere()) { if (pickupPoint.IsOccupied()) { GameObject recipesObj = GameObject.FindGameObjectWithTag("Recipes"); Recipes recipes = recipesObj.GetComponent <Recipes>(); GameObject itemObject = pickupPoint.GetItem(); if (itemObject != null) { Item anItem = itemObject.GetComponent <Item>(); if (anItem != null) { ItemType itemType = anItem.itemType; Item currentItemObj = currentItem.GetComponent <Item>(); if (currentItem != null) { Recipes.Recipe foundRecipe = recipes.GetRecipe(itemType, currentItemObj.itemType); if (foundRecipe.output != null) { GameObject go = Instantiate(mergableEffect, pickupPoint.gameObject.transform.position, Quaternion.identity); highlightEffectCache.Add(go); go.transform.SetParent(itemObject.transform); } } } } } else { if (pickupPoint.CanDropHere()) { GameObject go = Instantiate(highlightEffect, pickupPoint.gameObject.transform.position, Quaternion.identity); highlightEffectCache.Add(go); } } //} } }