public override bool ManualRead(string property, object value) { switch (property) { case "RemoteRole": RemoteRole = (int)value; break; case "Role": Role = (int)value; break; case "Instigator": Instigator = (ActorGUID)value; break; case "ReplicatedMovement": ReplicatedMovement = (FRepMovement)value; break; default: return(base.ManualRead(property, value)); } return(true); }
/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/bf95c2cbc703123e08ab54e3ceccdd47e48d224a/Engine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h#L3074 /// </summary> public FRepMovement SerializeRepMovement( VectorQuantization locationQuantizationLevel = VectorQuantization.RoundTwoDecimals, RotatorQuantization rotationQuantizationLevel = RotatorQuantization.ByteComponents, VectorQuantization velocityQuantizationLevel = VectorQuantization.RoundWholeNumber) { var repMovement = new FRepMovement(); var flags = ReadBits(2); repMovement.bSimulatedPhysicSleep = flags[0]; repMovement.bRepPhysics = flags[1]; repMovement.Location = SerializeQuantizedVector(locationQuantizationLevel); switch (rotationQuantizationLevel) { case RotatorQuantization.ByteComponents: repMovement.Rotation = ReadRotation(); break; case RotatorQuantization.ShortComponents: repMovement.Rotation = ReadRotationShort(); break; } repMovement.LinearVelocity = SerializeQuantizedVector(velocityQuantizationLevel); if (repMovement.bRepPhysics) { repMovement.AngularVelocity = SerializeQuantizedVector(velocityQuantizationLevel); } return(repMovement); }
} //Type: Bits: 1 public override bool ManualRead(string property, object value) { switch (property) { case "SharedRepMovement": SharedRepMovement = (FRepMovement)value; break; default: return(base.ManualRead(property, value)); } return(true); }
/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/bf95c2cbc703123e08ab54e3ceccdd47e48d224a/Engine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h#L3074 /// </summary> public FRepMovement SerializeRepMovement() { var repMovement = new FRepMovement(); var flags = ReadBitsToInt(2); repMovement.bSimulatedPhysicSleep = (flags & (1 << 0)) == 1; repMovement.bRepPhysics = (flags & (1 << 1)) == 1; repMovement.Location = SerializeQuantizedVector(VectorQuantization.RoundTwoDecimals); repMovement.Rotation = ReadRotation(); repMovement.LinearVelocity = SerializeQuantizedVector(VectorQuantization.RoundWholeNumber); if (repMovement.bRepPhysics) { repMovement.AngularVelocity = SerializeQuantizedVector(VectorQuantization.RoundWholeNumber); } return(repMovement); }
/// <summary> /// see https://github.com/EpicGames/UnrealEngine/blob/bf95c2cbc703123e08ab54e3ceccdd47e48d224a/Engine/Source/Runtime/Engine/Classes/Engine/EngineTypes.h#L3074 /// </summary> public FRepMovement SerializeRepMovement( VectorQuantization locationQuantizationLevel = VectorQuantization.RoundTwoDecimals, RotatorQuantization rotationQuantizationLevel = RotatorQuantization.ByteComponents, VectorQuantization velocityQuantizationLevel = VectorQuantization.RoundWholeNumber) { var repMovement = new FRepMovement { bSimulatedPhysicSleep = ReadBit(), bRepPhysics = ReadBit(), Location = SerializePropertyQuantizedVector(locationQuantizationLevel), Rotation = rotationQuantizationLevel == RotatorQuantization.ByteComponents ? ReadRotation() : ReadRotationShort(), LinearVelocity = SerializePropertyQuantizedVector(velocityQuantizationLevel) }; if (repMovement.bRepPhysics) { repMovement.AngularVelocity = SerializePropertyQuantizedVector(velocityQuantizationLevel); } return(repMovement); }