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

            return
                (this.PaintScheme == other.PaintScheme &&
                 this.Health == other.Health &&
                 this.Compliance == other.Compliance &&
                 this.FlashLights == other.FlashLights &&
                 this.LifeFormState == other.LifeFormState &&
                 this.FrozenStatus == other.FrozenStatus &&
                 this.State == other.State &&
                 this.Weapon1 == other.Weapon1 &&
                 this.Weapon2 == other.Weapon2 &&
                 this.CamouflageType == other.CamouflageType &&
                 this.ConcealedStationary == other.ConcealedStationary &&
                 this.ConcealedMovement == other.ConcealedMovement);
        }
Пример #2
0
        /// <summary>
        /// Creates the <see cref="DIS.OpenDIS.Enumerations.EntityState.Appearance.LifeFormAppearance"/> instance from the uint value.
        /// </summary>
        /// <param name="value">The uint value which represents the <see cref="DIS.OpenDIS.Enumerations.EntityState.Appearance.LifeFormAppearance"/> instance.</param>
        /// <returns>The <see cref="DIS.OpenDIS.Enumerations.EntityState.Appearance.LifeFormAppearance"/> instance, represented by the uint value.</returns>
        public static LifeFormAppearance FromUInt32(uint value)
        {
            LifeFormAppearance ps = new LifeFormAppearance();

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

            ps.PaintScheme = (LifeFormAppearance.PaintSchemeValue)newValue0;

            uint mask2     = 0x0018;
            byte shift2    = 3;
            uint newValue2 = (value & mask2) >> shift2;

            ps.Health = (LifeFormAppearance.HealthValue)newValue2;

            uint mask3     = 0x01e0;
            byte shift3    = 5;
            uint newValue3 = (value & mask3) >> shift3;

            ps.Compliance = (LifeFormAppearance.ComplianceValue)newValue3;

            uint mask5     = 0x1000;
            byte shift5    = 12;
            uint newValue5 = (value & mask5) >> shift5;

            ps.FlashLights = (LifeFormAppearance.FlashLightsValue)newValue5;

            uint mask7     = 0xf0000;
            byte shift7    = 16;
            uint newValue7 = (value & mask7) >> shift7;

            ps.LifeFormState = (LifeFormAppearance.LifeFormStateValue)newValue7;

            uint mask9     = 0x200000;
            byte shift9    = 21;
            uint newValue9 = (value & mask9) >> shift9;

            ps.FrozenStatus = (LifeFormAppearance.FrozenStatusValue)newValue9;

            uint mask11     = 0x800000;
            byte shift11    = 23;
            uint newValue11 = (value & mask11) >> shift11;

            ps.State = (LifeFormAppearance.StateValue)newValue11;

            uint mask12     = 0x3000000;
            byte shift12    = 24;
            uint newValue12 = (value & mask12) >> shift12;

            ps.Weapon1 = (LifeFormAppearance.Weapon1Value)newValue12;

            uint mask13     = 0xc000000;
            byte shift13    = 26;
            uint newValue13 = (value & mask13) >> shift13;

            ps.Weapon2 = (LifeFormAppearance.Weapon2Value)newValue13;

            uint mask14     = 0x30000000;
            byte shift14    = 28;
            uint newValue14 = (value & mask14) >> shift14;

            ps.CamouflageType = (LifeFormAppearance.CamouflageTypeValue)newValue14;

            uint mask15     = 0x40000000;
            byte shift15    = 30;
            uint newValue15 = (value & mask15) >> shift15;

            ps.ConcealedStationary = (LifeFormAppearance.ConcealedStationaryValue)newValue15;

            uint mask16     = 0x80000000;
            byte shift16    = 31;
            uint newValue16 = (value & mask16) >> shift16;

            ps.ConcealedMovement = (LifeFormAppearance.ConcealedMovementValue)newValue16;

            return(ps);
        }