Ejemplo n.º 1
0
    void OnTriggerStay2D(Collider2D collision)
    {
        IStationaryObjectUse usableObject = collision.GetComponent <IStationaryObjectUse>();

        if (usableObject != null && Input.GetKeyDown(KeyCode.F))
        {
            usableObject.Use();
        }

        PickableObject pickedObject = collision.GetComponent <PickableObject>();

        if (pickedObject != null && Input.GetKeyDown(KeyCode.F))
        {
            DropObject();
            pickedObject.Pickup();
            objectInHand = pickedObject;
            AttachObjectToHand(collision.transform);
        }
    }
Ejemplo n.º 2
0
    public void PickupObject(string objectName)
    {
        switch (objectName)
        {
        case "Keys":
            keys.Pickup();
            break;

        case "Wallet":
            wallet.Pickup();
            break;

        case "Phone":
            phone.Pickup();
            break;

        default:
            break;
        }
    }