public static PackedShipUpdate ReadFrom(ref BitReader message) { var p = new PackedShipUpdate(); p.ID = (int)message.GetUInt(32); p.Hidden = message.GetBool(); if (p.Hidden) { return(p); } p.CruiseThrust = (CruiseThrustState)message.GetUInt(2); p.HasPosition = message.GetBool(); p.HasOrientation = message.GetBool(); p.HasHealth = message.GetBool(); p.HasGuns = message.GetBool(); p.DockingLights = message.GetBool(); if (p.HasPosition) { p.Position = message.GetVector3(); p.EngineThrottlePct = message.GetByte(); } if (p.HasOrientation) { p.Orientation = message.GetQuaternion(); } if (p.CruiseThrust == CruiseThrustState.CruiseCharging) { p.CruiseChargePct = message.GetByte(); } if (p.HasHealth) { p.HasShield = message.GetBool(); p.HasHull = message.GetBool(); p.HasParts = message.GetBool(); if (p.HasParts) { p.Parts = new byte[message.GetByte()]; for (int i = 0; i < p.Parts.Length; i++) { p.Parts[i] = (byte)message.GetUInt(3); } } if (p.HasShield) { p.ShieldHp = message.GetInt(); } if (p.HasHull) { p.HullHp = message.GetInt(); } } if (p.HasGuns) { p.GunOrients = new GunOrient[message.GetByte()]; for (int i = 0; i < p.GunOrients.Length; i++) { p.GunOrients[i].ReadIn(ref message); } } return(p); }
public void ReadIn(ref BitReader message) { AnglePitch = message.GetRadiansQuantized(); AngleRot = message.GetRadiansQuantized(); }