Ejemplo n.º 1
0
        /// <summary>
        /// Scales an armor's weight based on the armor's size.
        /// </summary>
        /// <returns>The new weight.</returns>
        /// <param name="size">The armor's size.</param>
        /// <param name="mediumWeight">The medium-size weight for armor of this type.</param>
        /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception>
        protected static double WeightScaledBySize(SizeCategory size, double mediumWeight)
        {
            switch (size)
            {
            case SizeCategory.Small:  return(mediumWeight / 2.0);

            case SizeCategory.Medium: return(mediumWeight);

            case SizeCategory.Large:  return(mediumWeight * 2.0);

            default:
                throw new InvalidEnumArgumentException(nameof(size), (int)size, size.GetType());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Scales a shield's thickness based on the shield's size.
        /// </summary>
        /// <returns>The new thickness (in inches).</returns>
        /// <param name="size">The shield's size.</param>
        /// <param name="mediumInchesOfThickness">The thickness of a medium-size shield of this type.</param>
        /// <exception cref="System.ComponentModel.InvalidEnumArgumentException">Thrown when an argument is a nonstandard enum.</exception>
        protected static float InchesOfThicknessScaledBySize(SizeCategory size, float mediumInchesOfThickness)
        {
            switch (size)
            {
            case SizeCategory.Small:  return(mediumInchesOfThickness / 2f);

            case SizeCategory.Medium: return(mediumInchesOfThickness);

            case SizeCategory.Large:  return(mediumInchesOfThickness * 2f);

            default:
                throw new InvalidEnumArgumentException(nameof(size), (int)size, size.GetType());
            }
        }