Beispiel #1
0
 void OnPimDroppedItemEvent(Pim pim, Item item)
 {
     foreach (Transform child in transform)
     {
         Destroy(child.gameObject);
     }
 }
Beispiel #2
0
 void ClearAllHighlightedTiles(Pim pim, Item item)
 {
     foreach (GameObject go in highlightEffectCache)
     {
         Destroy(go);
     }
     highlightEffectCache.Clear();
 }
Beispiel #3
0
    void OnPimPickedUpItemEvent(Pim pim, Item item)
    {
        foreach (Transform child in transform)
        {
            Destroy(child.gameObject);
        }

        LookupRecipesForItem(item.itemType);
    }
Beispiel #4
0
    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);
                }
            }
            //}
        }
    }