예제 #1
0
        /// <summary>
        /// Adds the specified vehicle part to the <see cref="VehiclePartMap"/>.
        /// </summary>
        /// <param name="vehiclePart">The vehicle part to add.</param>
        public void AddPart([NotNull] IVehiclePart vehiclePart)
        {
            if (HasPart(vehiclePart) || !(vehiclePart is VehiclePart part))
            {
                return;
            }

            _parts.Add(vehiclePart.Id, part);
            part.Map = this;
        }
예제 #2
0
 /// <summary>
 /// Returns a value indicating whether the <see cref="VehiclePartMap"/> has the specified vehicle part.
 /// </summary>
 /// <param name="vehiclePart">The vehicle part to find.</param>
 /// <returns><c>true</c> if the vehicle part was found; otherwise, <c>false</c>.</returns>
 public bool HasPart([NotNull] IVehiclePart vehiclePart)
 {
     return(_parts.ContainsKey(vehiclePart.Id));
 }