Пример #1
0
        /// <summary>
        /// Creates the <see cref="DIS.OpenDIS.Enumerations.EntityState.Appearance.EnvironmentalAppearance"/> instance from the uint value.
        /// </summary>
        /// <param name="value">The uint value which represents the <see cref="DIS.OpenDIS.Enumerations.EntityState.Appearance.EnvironmentalAppearance"/> instance.</param>
        /// <returns>The <see cref="DIS.OpenDIS.Enumerations.EntityState.Appearance.EnvironmentalAppearance"/> instance, represented by the uint value.</returns>
        public static EnvironmentalAppearance FromUInt32(uint value)
        {
            EnvironmentalAppearance ps = new EnvironmentalAppearance();

            uint mask1     = 0xf0000;
            byte shift1    = 16;
            uint newValue1 = (value & mask1) >> shift1;

            ps.Density = (EnvironmentalAppearance.DensityValue)newValue1;

            uint mask3     = 0x200000;
            byte shift3    = 21;
            uint newValue3 = (value & mask3) >> shift3;

            ps.FrozenStatus = (EnvironmentalAppearance.FrozenStatusValue)newValue3;

            uint mask5     = 0x800000;
            byte shift5    = 23;
            uint newValue5 = (value & mask5) >> shift5;

            ps.State = (EnvironmentalAppearance.StateValue)newValue5;

            uint mask7     = 0x80000000;
            byte shift7    = 31;
            uint newValue7 = (value & mask7) >> shift7;

            ps.MaskedCloaked = (EnvironmentalAppearance.MaskedCloakedValue)newValue7;

            return(ps);
        }
Пример #2
0
        /// <summary>
        /// Determines whether the specified <see cref="DIS.OpenDIS.Enumerations.EntityState.Appearance.EnvironmentalAppearance"/> instance is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="DIS.OpenDIS.Enumerations.EntityState.Appearance.EnvironmentalAppearance"/> instance to compare with this instance.</param>
        /// <returns>
        ///     <c>true</c> if the specified <see cref="DIS.OpenDIS.Enumerations.EntityState.Appearance.EnvironmentalAppearance"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(EnvironmentalAppearance other)
        {
            // If parameter is null return false (cast to object to prevent recursive loop!)
            if ((object)other == null)
            {
                return(false);
            }

            return
                (this.Density == other.Density &&
                 this.FrozenStatus == other.FrozenStatus &&
                 this.State == other.State &&
                 this.MaskedCloaked == other.MaskedCloaked);
        }