Exemple #1
0
    public void OnTriggerExit2D(Collider2D other)
    {
        Drag_obj otherDrag = other.GetComponent <Drag_obj>();

        if (obj.GetInstanceID() == otherDrag.GetInstanceID()) //if it is our object, who came out
        {
            StartCoroutine(TakeBack());                       //get him back
        }
    }
    public void OnTriggerExit2D(Collider2D other)
    {
        if (null != obj)            //if we have an object
        {
            Drag_obj otherDrag = other.GetComponent <Drag_obj>();

            if (obj.GetInstanceID() == otherDrag.GetInstanceID()) //if it is our object
            {
                if (isDestination)                                //and object has not reached a cake
                {
                    obj.hasReachedDestination = false;
                }
                obj      = null;        //then slot is free
                occupied = false;
            }
        }
    }