internal Wheel(Dictionary <string, string> i_VehicleProperties) { m_ManufacturerName = i_VehicleProperties["Wheels manufacturer name"]; m_MaxPSI = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Wheels Maximum PSI amount"]); m_CurrentPSI = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Wheels current PSI amount"]); if (m_CurrentPSI > m_MaxPSI) { throw new ValueOutOfRangeException(0, m_MaxPSI); } }
internal EnergySource(Dictionary <string, string> i_VehicleProperties) { if (i_VehicleProperties["Type of energy"] == "Fuel") { m_MaxEnergy = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Maximum fuel capacity"]); m_EnergyLeft = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Current fuel amount"]); if (m_MaxEnergy < m_EnergyLeft) { throw new ArgumentException("The amount of fuel is over the limit."); } } else // It is a electric battery source { m_MaxEnergy = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Maximum battery capacity"]); m_EnergyLeft = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Current battery status"]); if (m_MaxEnergy < m_EnergyLeft) { throw new ArgumentException("The battery reached its limit."); } } }
public Truck(Dictionary <string, string> i_VehicleProperties) : base(i_VehicleProperties) { m_HasDeadlyMaterials = FieldsChecker.ValidationOfDangerousAnswer(i_VehicleProperties["Does carry dangerous materials?"]); m_MaxWeightAllowed = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Maximum weight allowed"]); }
internal Wheel(Dictionary <string, string> i_VehicleProperties) { m_ManufacturerName = i_VehicleProperties["Wheels manufacturer name"]; m_CurrentPSI = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Wheels current PSI amount"]); m_MaxPSI = FieldsChecker.StringProperyToFloat(i_VehicleProperties["Wheels Maximum PSI amount"]); }