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

            return
                (this.PercentComplete == other.PercentComplete &&
                 this.Damage == other.Damage &&
                 this.Predistributed == other.Predistributed &&
                 this.State == other.State &&
                 this.Smoking == other.Smoking &&
                 this.Flaming == other.Flaming);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the <see cref="OpenDis.Enumerations.Environment.ObjectState.GeneralAppearance"/> instance from the ushort value.
        /// </summary>
        /// <param name="value">The ushort value which represents the <see cref="OpenDis.Enumerations.Environment.ObjectState.GeneralAppearance"/> instance.</param>
        /// <returns>The <see cref="OpenDis.Enumerations.Environment.ObjectState.GeneralAppearance"/> instance, represented by the ushort value.</returns>
        public static GeneralAppearance FromUInt16(ushort value)
        {
            GeneralAppearance ps = new GeneralAppearance();

            uint mask0     = 0x00ff;
            byte shift0    = 0;
            uint newValue0 = value & mask0 >> shift0;

            ps.PercentComplete = (byte)newValue0;

            uint mask1     = 0x0300;
            byte shift1    = 8;
            uint newValue1 = value & mask1 >> shift1;

            ps.Damage = (GeneralAppearance.DamageValue)newValue1;

            uint mask2     = 0x0400;
            byte shift2    = 10;
            uint newValue2 = value & mask2 >> shift2;

            ps.Predistributed = (GeneralAppearance.PredistributedValue)newValue2;

            uint mask3     = 0x0800;
            byte shift3    = 11;
            uint newValue3 = value & mask3 >> shift3;

            ps.State = (GeneralAppearance.StateValue)newValue3;

            uint mask4     = 0x1000;
            byte shift4    = 12;
            uint newValue4 = value & mask4 >> shift4;

            ps.Smoking = (GeneralAppearance.SmokingValue)newValue4;

            uint mask5     = 0x2000;
            byte shift5    = 13;
            uint newValue5 = value & mask5 >> shift5;

            ps.Flaming = (GeneralAppearance.FlamingValue)newValue5;

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

            return
                this.PercentComplete == other.PercentComplete &&
                this.Damage == other.Damage &&
                this.Predistributed == other.Predistributed &&
                this.State == other.State &&
                this.Smoking == other.Smoking &&
                this.Flaming == other.Flaming;
        }
Esempio n. 4
0
        /// <summary>
        /// Creates the <see cref="OpenDis.Enumerations.Environment.ObjectState.GeneralAppearance"/> instance from the ushort value.
        /// </summary>
        /// <param name="value">The ushort value which represents the <see cref="OpenDis.Enumerations.Environment.ObjectState.GeneralAppearance"/> instance.</param>
        /// <returns>The <see cref="OpenDis.Enumerations.Environment.ObjectState.GeneralAppearance"/> instance, represented by the ushort value.</returns>
        public static GeneralAppearance FromUInt16(ushort value)
        {
            GeneralAppearance ps = new GeneralAppearance();

            uint mask0 = 0x00ff;
            byte shift0 = 0;
            uint newValue0 = value & mask0 >> shift0;
            ps.PercentComplete = (byte)newValue0;

            uint mask1 = 0x0300;
            byte shift1 = 8;
            uint newValue1 = value & mask1 >> shift1;
            ps.Damage = (GeneralAppearance.DamageValue)newValue1;

            uint mask2 = 0x0400;
            byte shift2 = 10;
            uint newValue2 = value & mask2 >> shift2;
            ps.Predistributed = (GeneralAppearance.PredistributedValue)newValue2;

            uint mask3 = 0x0800;
            byte shift3 = 11;
            uint newValue3 = value & mask3 >> shift3;
            ps.State = (GeneralAppearance.StateValue)newValue3;

            uint mask4 = 0x1000;
            byte shift4 = 12;
            uint newValue4 = value & mask4 >> shift4;
            ps.Smoking = (GeneralAppearance.SmokingValue)newValue4;

            uint mask5 = 0x2000;
            byte shift5 = 13;
            uint newValue5 = value & mask5 >> shift5;
            ps.Flaming = (GeneralAppearance.FlamingValue)newValue5;

            return ps;
        }