Container.RemoveItemFromContainer C# (CSharp) Method

RemoveItemFromContainer() public method

public RemoveItemFromContainer ( int index ) : bool
index int
return bool
    public bool RemoveItemFromContainer(int index)
    {
        if (items[index] != "")
            {
            items[index]="";
            return true;
            }
        else
            {
            return false;
            }
    }

Same methods

Container::RemoveItemFromContainer ( string objectName ) : bool

Usage Example

 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>().ItemType == 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);
                     }
                 }
             }
         }
     }
 }
All Usage Examples Of Container::RemoveItemFromContainer