예제 #1
0
 // Longhand operators
 /// <summary>
 /// Tests for equality between this percentage and another.
 /// </summary>
 /// <param name="right">The percentage against which this one is being compared.</param>
 /// <returns>A Boolean indicating whether or not the two percentages are equal.</returns>
 public bool Equals(percent right)
 {
     return Value == right.Value;
 }
예제 #2
0
        /* CONSTRUCTOR METHOD */
        /// <summary>
        /// Construct a biome with a completely known set of parameters.
        /// </summary>
        /// <param name="elevation"></param>
        /// <param name="humidity"></param>
        /// <param name="foliageDensity"></param>
        /// <param name="roughness"></param>
        /// <param name="temperature"></param>
        /// <param name="treesDensity"></param>
        public Biome(float elevation, percent humidity, percent foliageDensity, float roughness, float temperature, percent treesDensity)
        {
            // Fill in all determinate parameters
            Elevation = elevation;
            Humidity = humidity;
            Foliage = foliageDensity;
            Roughness = roughness;
            Temperature = temperature;
            Trees = treesDensity;

            ElevationGen = Vector2.Zero;
            RoughnessGen = Vector2.Zero;
        }
예제 #3
0
 /// <summary>
 /// Converts a percentage value into its string representation.
 /// </summary>
 /// <param name="x">The percentage integer being converted.</param>
 /// <returns>The string representation of the inputted percentage integer.</returns>
 public static string ToString(percent x)
 {
     return x.ToString();
 }
예제 #4
0
 /// <summary>
 /// Converts a percentage value into a 32-bit signed integer value.
 /// </summary>
 /// <param name="x">The percentage integer being converted.</param>
 /// <returns>A signed integer that is equivalent to the inputted percentage integer.</returns>
 public static int ToInt(percent x)
 {
     return x.ToInt();
 }
예제 #5
0
 /// <summary>
 /// Converts a percentage value into a 32-bit single precision fractional value.
 /// </summary>
 /// <param name="x">The percentage integer being converted.</param>
 /// <returns>A single precision fraction of 1 equivalent to the inputted percentage integer.</returns>
 public static float ToFloat(percent x)
 {
     return x.ToFloat();
 }
예제 #6
0
 /// <summary>
 /// Converts a percentage value into a 64-bit double precision fractional value.
 /// </summary>
 /// <param name="x">The percentage integer being converted.</param>
 /// <returns>A double precision fraction of 1 equivalent to the inputted percentage integer.</returns>
 public static double ToDouble(percent x)
 {
     return x.ToDouble();
 }
예제 #7
0
 /// <summary>
 /// Test for equality between two percentage values.
 /// </summary>
 /// <param name="left">The first percentage value.</param>
 /// <param name="right">The second percentage value being compared with the first.</param>
 /// <returns>A Boolean indicating whether or not the two percentages are equal.</returns>
 public static bool Equals(percent left, percent right)
 {
     return left.Value == right.Value;
 }