Exemplo n.º 1
0
 public PositionPlayerState(FullPlayerState fullState)
 {
     Type           = PlayerStateType.Position;
     SteamIDIndex   = fullState.SteamIDIndex;
     Position       = fullState.Position;
     ViewOffsetZ    = fullState.ViewOffsetZ;
     Velocity       = fullState.Velocity;
     ViewDirectionX = fullState.ViewDirectionX;
     ViewDirectionY = fullState.ViewDirectionY;
 }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            FullPlayerState other = (FullPlayerState)obj;

            if (NameIndex != other.NameIndex)
            {
                return(false);
            }

            if (HP != other.HP)
            {
                return(false);
            }

            if (Armor != other.Armor)
            {
                return(false);
            }

            if (FlashDuration != other.FlashDuration)
            {
                return(false);
            }

            if (Money != other.Money)
            {
                return(false);
            }

            if (CurrentEquipmentValue != other.CurrentEquipmentValue)
            {
                return(false);
            }

            if (FreezetimeEndEquipmentValue != other.FreezetimeEndEquipmentValue)
            {
                return(false);
            }

            if (RoundStartEquipmentValue != other.RoundStartEquipmentValue)
            {
                return(false);
            }

            if (IsDucking != other.IsDucking)
            {
                return(false);
            }

            if (ActiveWeaponID != other.ActiveWeaponID)
            {
                return(false);
            }

            if (Team != other.Team)
            {
                return(false);
            }

            if (HasDefuseKit != other.HasDefuseKit)
            {
                return(false);
            }

            if (HasHelmet != other.HasHelmet)
            {
                return(false);
            }

            if (AmmoLeft.Count != other.AmmoLeft.Count)
            {
                return(false);
            }

            if (IsScoped != other.IsScoped)
            {
                return(false);
            }

            if (ShotsFired != other.ShotsFired)
            {
                return(false);
            }

            if (!AimPunchAngle.Equals(other.AimPunchAngle))
            {
                return(false);
            }


            var ammoList      = AmmoLeft.ToList();
            var otherAmmoList = other.AmmoLeft.ToList();

            for (int i = 0; i < ammoList.Count; i++)
            {
                if (ammoList[i].Key != otherAmmoList[i].Key)
                {
                    return(false);
                }

                if (ammoList[i].Value != otherAmmoList[i].Value)
                {
                    return(false);
                }
            }

            if (Weapons.Count != other.Weapons.Count)
            {
                return(false);
            }

            var weaponsList      = Weapons.ToList();
            var otherWeaponsList = other.Weapons.ToList();

            for (int i = 0; i < weaponsList.Count; i++)
            {
                if (weaponsList[i].Key != otherWeaponsList[i].Key)
                {
                    return(false);
                }

                if (!weaponsList[i].Value.Equals(otherWeaponsList[i].Value))
                {
                    return(false);
                }
            }

            return(true);
        }