public static void SetPickedUpFlag(Container cn, bool NewValue)
{
//Recursivly sets the picked up flag on all items in the container and all sub-container contents.
for (int i =0; i<=cn.MaxCapacity();i++)
{
string ItemName=cn.GetItemAt(i);
if (ItemName != "")
{
GameObject item = GameObject.Find (cn.GetItemAt(i));
if (item !=null)
{
if (item.GetComponent<ObjectInteraction>()!=null)
{
item.GetComponent<ObjectInteraction>().PickedUp=NewValue;
if (item.GetComponent<ObjectInteraction>().GetItemType()==ObjectInteraction.A_PICK_UP_TRIGGER)
{//Special case
item.GetComponent<a_pick_up_trigger>().Activate();
//if (item==null)
//{//Use trigger is no more.
cn.RemoveItemFromContainer(i);
//}
}
else if (item.GetComponent<Container>()!=null)
{
Container.SetPickedUpFlag(item.GetComponent<Container>(),NewValue);
}
}
}
}
}
}