Example #1
0
    public void EnterTrashbin(Collider other)
    {
        GeneralItem item = GeneralItem.Find(other.transform);

        if (item != null)
        {
            if (trashType == TrashType.Sharp && item.ObjectType != ObjectType.Needle)
            {
                TaskBase.CreateGeneralMistake("Normaali esine laitettiin terävien roskikseen", 1, true);
                Events.FireEvent(EventType.ItemDroppedInWrongTrash);
            }
            else if (trashType == TrashType.Nonsharp && item.ObjectType == ObjectType.Needle)
            {
                TaskBase.CreateGeneralMistake("Neula laitettiin normaaliin roskikseen", 1, true);
                Events.FireEvent(EventType.ItemDroppedInWrongTrash);
            }

            //PrepareObjectForRemoving(item);

            if (item.ObjectType == ObjectType.Luerlock)
            {
                Logger.Print("Trash bin luerlock count: " + ((LuerlockAdapter)item).AttachedInteractables.Count);
            }

            PrepareObjectForRemoving(item);

            Events.FireEvent(EventType.ItemDroppedInTrash, CallbackData.Object(item));
            item.DestroyInteractable();
        }
    }
Example #2
0
    private void OnTriggerExit(Collider other)
    {
        GameObject gm = Interactable.GetInteractableObject(other.transform);

        if (gm == null)
        {
            return;
        }

        GeneralItem item = gm.GetComponent <GeneralItem>();

        if (item == null)
        {
            return;
        }

        if (MultiColliderTool.CheckCollision(gameObject, item.gameObject))
        {
            return;
        }

        //Events.FireEvent(EventType.ItemDroppedOnFloor, CallbackData.Object(item));
        item.DestroyInteractable();
    }