示例#1
0
 /// <summary>
 ///		Removes a part from the collection
 /// </summary>
 /// <param name="part"> The part to be removed </param>
 public void Remove(ShipPart part)
 {
     ShipPart [] arr = lists[part.GetType()];
     for (int i = 0; i < arr.Length; i++)
     {
         if (arr [i] == part)
         {
             arr [i] = null;
             return;
         }
     }
 }
示例#2
0
 /// <summary>
 ///		Adds a Part to the collection
 /// </summary>
 /// <param name="part"> The part to be added </param>
 public void Add(ShipPart part)
 {
     ShipPart [] arr = lists[part.GetType()];
     for (int i = 0; i < arr.Length; i++)
     {
         if (arr [i] == null)
         {
             arr [i] = part;
             return;
         }
     }
     throw new OverflowException("Array is full");
 }