コード例 #1
0
        /// <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);
            }
        }
コード例 #2
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--;
     }
 }