Ejemplo n.º 1
0
 //===================================================================//
 //                            Booleans                               //
 //===================================================================//
 /// <summary>
 /// Determines whether or not it is possible for two pieces of clothing to be worn together.
 /// </summary>
 /// <param name="other">the other piece of clothing</param>
 /// <returns>true if the two pieces of clothing cannot be worn together; false otherwise</returns>
 public bool CannotBeWornWith(Clothing other)
 {
     foreach (ClothingSlot slot in this.slots) {
         if (other.slots.Contains(slot)) {
             return true;
         }
     }
     if (   (this.slots.Contains(ClothingSlot.tights) && other.slots.Contains(ClothingSlot.socks))
         || (this.slots.Contains(ClothingSlot.socks) && other.slots.Contains(ClothingSlot.tights))   )
     {
         return true;
     }
     if ((this.slots.Contains(ClothingSlot.pants) && other.slots.Contains(ClothingSlot.skirt))
         || (this.slots.Contains(ClothingSlot.skirt) && other.slots.Contains(ClothingSlot.pants)))
     {
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Determines whether this clothing will get in the way of putting on or taking off another piece of clothing.
 /// </summary>
 /// <param name="other">the other piece of clothing</param>
 /// <returns>true if this does get in the way; false otherwise</returns>
 public bool GetsInTheWayOf(Clothing other)
 {
     if (this.CannotBeWornWith(other))
     {
         return true;
     }
     else if (this.slots.Contains(ClothingSlot.shoes) && (other.slots.Contains(ClothingSlot.socks) || other.slots.Contains(ClothingSlot.tights)))
     {
             return true;
     }
     else if (this.slots.Contains(ClothingSlot.tights) && other.slots.Contains(ClothingSlot.underpants))
     {
         return true;
     }
     else if (this.slots.Contains(ClothingSlot.pants) && (other.slots.Contains(ClothingSlot.underpants) || other.slots.Contains(ClothingSlot.tights)))
     {
         return true;
     }
     else if (this.slots.Contains(ClothingSlot.shirt) && other.slots.Contains(ClothingSlot.undershirt))
     {
         return true;
     }
     else if (this.slots.Contains(ClothingSlot.jacket) && (other.slots.Contains(ClothingSlot.shirt) || other.slots.Contains(ClothingSlot.undershirt)))
     {
         return true;
     }
     else if (this.slots.Contains(ClothingSlot.ring) && other.slots.Contains(ClothingSlot.gloves))
     {
         return true;
     }
     return false;
 }