예제 #1
0
        /// <summary>
        /// Determines whether the specified <see cref="DIS.OpenDIS.Enumerations.Environment.ObjectState.Minefield"/> instance is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="DIS.OpenDIS.Enumerations.Environment.ObjectState.Minefield"/> instance to compare with this instance.</param>
        /// <returns>
        ///     <c>true</c> if the specified <see cref="DIS.OpenDIS.Enumerations.Environment.ObjectState.Minefield"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(Minefield other)
        {
            // If parameter is null return false (cast to object to prevent recursive loop!)
            if ((object)other == null)
            {
                return(false);
            }

            return
                (this.Breach == other.Breach &&
                 this.MineCount == other.MineCount);
        }
예제 #2
0
        /// <summary>
        /// Creates the <see cref="DIS.OpenDIS.Enumerations.Environment.ObjectState.Minefield"/> instance from the uint value.
        /// </summary>
        /// <param name="value">The uint value which represents the <see cref="DIS.OpenDIS.Enumerations.Environment.ObjectState.Minefield"/> instance.</param>
        /// <returns>The <see cref="DIS.OpenDIS.Enumerations.Environment.ObjectState.Minefield"/> instance, represented by the uint value.</returns>
        public static Minefield FromUInt32(uint value)
        {
            Minefield ps = new Minefield();

            uint mask0     = 0x30000;
            byte shift0    = 16;
            uint newValue0 = (value & mask0) >> shift0;

            ps.Breach = (Minefield.BreachValue)newValue0;

            uint mask2     = 0x80000000;
            byte shift2    = 31;
            uint newValue2 = (value & mask2) >> shift2;

            ps.MineCount = (int)newValue2;

            return(ps);
        }