DestroyItemCoroutine() public method

public DestroyItemCoroutine ( ) : IEnumerator
return IEnumerator
示例#1
0
 private void OnDropAttached(PointerEventData data)
 {
     if (data.pointerPress != null)
     {
         Item dragItem = data.pointerPress.GetComponent <Item>();
         if (dragItem != null && dragItem.HasTag("Color"))
         {
             StartCoroutine(dragItem.DestroyItemCoroutine());
         }
     }
 }
        private void OnEndDragDragging(PointerEventData data)
        {
            Item item = GetComponent <Item>();

            if (ThisEnteredDropItem == null)
            {
                StartCoroutine(item.DestroyItemCoroutine());
            }
            else
            {
                item.RemoveFromHoldList();
                AccessoryRendererState = true;
                item.SetLayerRecursive(8);
                item.State = ItemState.AttachedHighlighted;
            }
        }
        private void OnPointerUpInstantiate(PointerEventData data)
        {
                        #if LOG
            Debug.Log("OnPointerUpAttachedHighlighted " + this.name);
                        #endif

            VisualizationUI plannerUI            = FindObjectOfType <VisualizationUI>();
            Item            instantiatedItem     = plannerUI.InstantiateSelectedItem(data);
            ItemDrag        instantiatedItemDrag = instantiatedItem.GetComponent <ItemDrag>();
            ItemDrop        itemDrop             = GetComponent <ItemDrop>();
            if (itemDrop != null)
            {
                instantiatedItemDrag.ThisEnteredDropItem = itemDrop;
                instantiatedItemDrag.ParentItemDrop      = itemDrop;

                ItemSnap itemSnap = instantiatedItemDrag.NearestItemSnap(data);
                instantiatedItemDrag.ParentItemSnap = itemSnap;
                Ray ray = itemSnap.Snap(instantiatedItem, data);
                instantiatedItemDrag.SetTargetPositionRotation(ray.origin, ray.direction);
                //set to outline and normal to get rid of quirk where instantied shader isn't immediately properly lit
                instantiatedItem.SetShaderOutline(_itemSettings.InstantiateOutlineColor);
                instantiatedItem.SetShaderNormal();
                instantiatedItem.State = ItemState.NoInstantiate;

                //TODO this should always be able to attach, why are we checking?
                if (itemDrop.CanAttach(instantiatedItem.TagArray))
                {
                    SetShaderOutline(_itemSettings.InstantiateOutlineColor);
                }
                else
                {
                    SetShaderNormal();
                    State = ItemState.NoInstantiate;
                }
            }
            ItemColor itemColor = GetComponent <ItemColor>();
            if (itemColor != null)
            {
                Item item = GetComponent <Item>();
                item.SetBlendMaterial(instantiatedItem.MaterialArray[0].mainTexture);
                SetShaderNormal();
                State = ItemState.NoInstantiate;
                StartCoroutine(instantiatedItem.DestroyItemCoroutine());
            }
        }