コード例 #1
0
 public void EquipDiver(Diver diver, Dive dive)
 {
     // Equip with basic equipment
     if (diver.IsBasicEquipmentAssociation() == true &&
         temperature == "#" &&
         needForRecording == "#" &&
         needForNightDive == "#" &&
         stock > 0 &&
         !diver.CheckExistingEquipmentByCategory(ID))
     {
         diver.AddEquipment(this);
         stock--;
     }
     // Equip with dry suits
     if (dive.GetTemperature() < 15 &&
         (ID.StartsWith("1.1.3.") || ID.StartsWith("1.2.") || ID.StartsWith("1.4.") || (ID.StartsWith("1.3.") && temperature != "#" && Int32.Parse(temperature) < 15)) &&
         stock > 0 &&
         !diver.CheckExistingEquipmentByCategory(ID))
     {
         diver.AddEquipment(this);
         stock--;
     }
     // Equip with wet suits
     else if (dive.GetTemperature() >= 15 &&
              (ID.StartsWith("1.1.1.") || ID.StartsWith("1.1.2.") || (ID.StartsWith("1.3.") && temperature != "#" && Int32.Parse(temperature) >= 15)) &&
              stock > 0 &&
              !diver.CheckExistingEquipmentByCategory(ID))
     {
         diver.AddEquipment(this);
         stock--;
     }
     // Equip with equipment for night dive
     if (dive.IsNightDive() == true &&
         needForNightDive == "*" &&
         !diver.CheckExistingEquipmentByCategory(ID))
     {
         diver.AddEquipment(this);
         stock--;
     }
     // Equip with equipment for fotographers
     if (diver.CheckIfDiverHasSuperPower("Podvodni fotograf") == true &&
         needForRecording == "*" &&
         !diver.CheckExistingEquipmentByCategory(ID))
     {
         diver.AddEquipment(this);
         stock--;
     }
 }