예제 #1
0
    private void OnTriggerEnter(Collider other)
    {
        ItemPickup item = other.gameObject.GetComponent <ItemPickup>();

        //print("Collided with " + other.gameObject.name);
        if (item != null && item != lastItem)
        {
            if (item.CanPickUp())
            {
                // then try talking with it!
                item.PickUp();
                lastItem = item;
            }
        }
    }