/// <summary> /// Equip diver with adequate equipment for dive /// - Hope your eyes won't bleed on this one /// </summary> /// <param name="diver">Diver that we're equipping</param> /// <param name="dive">Dive for which we're equipping diver</param> public void EquipDiver(Diver diver, Dive dive) { // Equip with basic equipment if (EquipmentHelper.IsBasicEquipment(this)) { LendEquipment(dive, diver); } // Equip with dry suit else if (dive.temperature < Constants.TEMPERATURE_BOUNDARY && EquipmentHelper.IsDrySuit(this) && !diver.CheckIfDiverNeedUndersuit()) { LendEquipment(dive, diver); } // Equip with undersuit else if (EquipmentHelper.IsUndersuit(this) && diver.CheckIfDiverNeedUndersuit()) { LendEquipment(dive, diver); } // Equip with wet suit else if (dive.temperature >= Constants.TEMPERATURE_BOUNDARY && EquipmentHelper.IsWetSuit(this)) { LendEquipment(dive, diver); } // Equip with hood if needed else if (dive.temperature >= 15 && EquipmentHelper.IsHood(this) && diver.CheckIfDiverNeedHood()) { LendEquipment(dive, diver); } // Equip with equipment for night dive else if (dive.isNightDive && needForNightDive == Constants.EQUIPMENT_NEEDED && diver.CheckIfDiverHasSuperPower(Constants.NIGHT_DIVE)) { LendEquipment(dive, diver); } // Equip with equipment for photographers else if (dive.numOfPhotographers > 0 && diver.CheckIfDiverHasSuperPower(Constants.PHOTOGRAPHER) && needForRecording == Constants.EQUIPMENT_NEEDED) { LendEquipment(dive, diver); } // Additional equipment else if (EquipmentHelper.IsAdditionalEquipment(this) && temperature != "#" && dive.temperature < 20 || EquipmentHelper.IsAdditionalEquipment(this) && temperature == "#") { LendEquipment(dive, diver); } }
/// <summary> /// Update diver equipment status /// FULLY EQUIPED - basic equipment + all additional equipment /// PARTIALLY EQUIPED - basic equipment /// NOT EQUIPED - without basic equipment /// </summary> public void UpdateEquipmentStatus(Dive dive) { int basicEquipmentCounter = 0; // Check if user have all basic equipment foreach (ConcreteEquipment equipment in equipmentList) { if (EquipmentHelper.IsBasicEquipment(equipment)) { basicEquipmentCounter++; } } // Basic equipment if (basicEquipmentCounter == Constants.NUM_OF_BASIC_EQUIPMENT && equipmentList.Count() == Constants.NUM_OF_BASIC_EQUIPMENT) { equipmentStatus = Constants.PARTIALLY_EQUIPED; } // Diver is not adequate equiped for dive else if (basicEquipmentCounter < Constants.NUM_OF_BASIC_EQUIPMENT) { equipmentStatus = Constants.NOT_EQUIPED; } // Basic + additional equipment else if ( // If it's cold dive then check if diver is adequate equipped for cold dive (dive.temperature < Constants.TEMPERATURE_BOUNDARY && EquipmentHelper.IsDiverAdequatEquippedForColdDive(equipmentList)) || // If it's dive with temp above 15 and diver is adequate equipped for that dive (dive.temperature >= Constants.TEMPERATURE_BOUNDARY && EquipmentHelper.IsDiverAdequateEquippedForWarmDive(equipmentList)) && // If it's night dive then check if diver is adequate equipped for night dive ((dive.isNightDive && EquipmentHelper.IsDiverAdequateEquippedForNightDive(EquipmentList)) || !dive.isNightDive) ) { equipmentStatus = Constants.FULLY_EQUIPED; } }