本文整理汇总了C#中VRage.Library.Collections.BitStream.ReadFloat方法的典型用法代码示例。如果您正苦于以下问题:C# BitStream.ReadFloat方法的具体用法?C# BitStream.ReadFloat怎么用?C# BitStream.ReadFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VRage.Library.Collections.BitStream
的用法示例。
在下文中一共展示了BitStream.ReadFloat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeFriction
protected void SerializeFriction(BitStream stream, MyEntity entity)
{
MyPhysicsBody pb = entity.Physics as MyPhysicsBody;
if (pb == null || pb.RigidBody == null)
{
if (stream.Writing)
stream.WriteFloat(0);
else
stream.ReadFloat();
return;
}
HkRigidBody rb = pb.RigidBody;
if (stream.Writing)
stream.WriteFloat(rb.Friction);
else
rb.Friction = stream.ReadFloat();
}
示例2: SerializeRopeData
private void SerializeRopeData(BitStream stream, bool applyWhenReading, List<MyCubeGrid> gridsGroup = null)
{
if (MyRopeComponent.Static == null)
return;
if (stream.Writing)
{
m_tmpRopes.Clear();
m_tmpRopeGrids.Clear();
m_tmpRopeGrids.Add(Entity);
Debug.Assert(gridsGroup != null);
if (gridsGroup != null)
{
foreach (var grid in gridsGroup)
m_tmpRopeGrids.Add(grid);
}
MyRopeComponent.Static.GetRopesForGrids(m_tmpRopeGrids, m_tmpRopes);
MyRopeData ropeData;
stream.WriteUInt16((ushort)m_tmpRopes.Count);
foreach (var rope in m_tmpRopes)
{
var ropeProxyTarget = MyMultiplayer.Static.ReplicationLayer.GetProxyTarget((IMyEventProxy)rope);
NetworkId ropeNetworkId = MyMultiplayer.Static.ReplicationLayer.GetNetworkIdByObject(ropeProxyTarget);
stream.WriteNetworkId(ropeNetworkId);
//TODO - MyRopeComponent should be rewritten to singleton
MyRopeComponent.GetRopeData(rope.EntityId, out ropeData);
stream.WriteFloat(ropeData.CurrentRopeLength);
}
m_tmpRopes.Clear();
m_tmpRopeGrids.Clear();
}
else
{
uint ropesCount = stream.ReadUInt16();
for (uint i = 0; i < ropesCount; ++i)
{
NetworkId ropeNetworkId = stream.ReadNetworkId();
float ropeLength = stream.ReadFloat();
MyRopeReplicable replicable = MyMultiplayer.Static.ReplicationLayer.GetObjectByNetworkId(ropeNetworkId) as MyRopeReplicable;
MyRope rope = replicable != null ? replicable.Instance : null;
if (rope != null && applyWhenReading)
MyRopeComponent.Static.SetRopeLengthSynced(rope.EntityId, ropeLength);
}
}
}
示例3: ReadCharacterState
static MyCharacterNetState ReadCharacterState(BitStream stream)
{
MyCharacterNetState charNetState = new MyCharacterNetState();
charNetState.HeadX = stream.ReadHalf();
if (charNetState.HeadX.IsValid() == false)
{
charNetState.HeadX = 0.0f;
}
charNetState.HeadY = stream.ReadHalf();
charNetState.Spine = stream.ReadQuaternionNormCompressedIdentity();
charNetState.Head = stream.ReadQuaternionNormCompressedIdentity();
charNetState.MovementState = (MyCharacterMovementEnum)stream.ReadUInt16();
charNetState.MovementFlag = (MyCharacterMovementFlags)stream.ReadUInt16();
charNetState.Jetpack = stream.ReadBool();
charNetState.Dampeners = stream.ReadBool();
charNetState.Lights = stream.ReadBool(); // TODO: Remove
charNetState.Ironsight = stream.ReadBool();
charNetState.Broadcast = stream.ReadBool(); // TODO: Remove
charNetState.TargetFromCamera = stream.ReadBool();
charNetState.Movement = stream.ReadNormalizedSignedVector3(8);
charNetState.Rotation.X = stream.ReadFloat();
charNetState.Rotation.Y = stream.ReadFloat();
charNetState.Speed = stream.ReadFloat();
charNetState.Roll = stream.ReadFloat();
return charNetState;
}