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

            return
                this.MinefieldType == other.MinefieldType &&
                this.ActiveStatus == other.ActiveStatus &&
                this.Lane == other.Lane &&
                this.State == other.State;
        }
Example #2
0
        /// <summary>
        /// Creates the <see cref="OpenDis.Enumerations.Entity.Information.Minefield.Appearance"/> instance from the ushort value.
        /// </summary>
        /// <param name="value">The ushort value which represents the <see cref="OpenDis.Enumerations.Entity.Information.Minefield.Appearance"/> instance.</param>
        /// <returns>The <see cref="OpenDis.Enumerations.Entity.Information.Minefield.Appearance"/> instance, represented by the ushort value.</returns>
        public static Appearance FromUInt16(ushort value)
        {
            Appearance ps = new Appearance();

            uint mask0 = 0x0003;
            byte shift0 = 0;
            uint newValue0 = value & mask0 >> shift0;
            ps.MinefieldType = (Appearance.MinefieldTypeValue)newValue0;

            uint mask1 = 0x0004;
            byte shift1 = 2;
            uint newValue1 = value & mask1 >> shift1;
            ps.ActiveStatus = (Appearance.ActiveStatusValue)newValue1;

            uint mask2 = 0x0008;
            byte shift2 = 3;
            uint newValue2 = value & mask2 >> shift2;
            ps.Lane = (Appearance.LaneValue)newValue2;

            uint mask4 = 0x2000;
            byte shift4 = 13;
            uint newValue4 = value & mask4 >> shift4;
            ps.State = (Appearance.StateValue)newValue4;

            return ps;
        }