当前位置: 首页>>代码示例>>C#>>正文


C# VRage.ReadFloat方法代码示例

本文整理汇总了C#中VRage.ReadFloat方法的典型用法代码示例。如果您正苦于以下问题:C# VRage.ReadFloat方法的具体用法?C# VRage.ReadFloat怎么用?C# VRage.ReadFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VRage的用法示例。


在下文中一共展示了VRage.ReadFloat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ServerRead

        protected override void ServerRead(VRage.Library.Collections.BitStream stream, ulong clientId,uint timestamp)
        {
            base.ServerRead(stream, clientId, timestamp);
            if (stream.ReadBool())
            {
                if (m_grid != null)
                {
                    bool isStatic = stream.ReadBool();
                    if (isStatic == false)
                    {
                        if (stream.ReadBool())
                        {
                            long entityId = stream.ReadInt64();
                            Vector2 rotation = new Vector2();
                            rotation.X = stream.ReadFloat();
                            rotation.Y = stream.ReadFloat();

                            float roll = stream.ReadHalf();

                            Vector3 move = new Vector3();
                            move.X = stream.ReadHalf();
                            move.Y = stream.ReadHalf();
                            move.Z = stream.ReadHalf();

                            MyShipController controller;
                            if (MyEntities.TryGetEntityById<MyShipController>(entityId, out controller))
                            {
                                controller.CacheMoveAndRotate(ref move, ref rotation, roll);
                            }
                        }
                    }
                }
            }
        }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:34,代码来源:MyGridPositionVerificationStateGroup.cs

示例2: ServerRead

        protected override void ServerRead(VRage.Library.Collections.BitStream stream, ulong clientId,uint timestamp)
        {
            base.ServerRead(stream, clientId, timestamp);
            if (stream.ReadBool())
            {
                if (m_grid != null)
                {
                    bool isStatic = stream.ReadBool();
                    if (isStatic == false)
                    {
                        if (stream.ReadBool())
                        {
                            long entityId = stream.ReadInt64();
                            Vector2 rotation = new Vector2();
                            rotation.X = stream.ReadFloat();
                            rotation.Y = stream.ReadFloat();

                            float roll = stream.ReadHalf();

                            Vector3 move = new Vector3();
                            move.X = stream.ReadHalf();
                            move.Y = stream.ReadHalf();
                            move.Z = stream.ReadHalf();

                            Vector3D gridPos = Vector3D.Zero;
                            MyShipController controller;
                            if (MyEntities.TryGetEntityById<MyShipController>(entityId, out controller))
                            {
                                controller.CacheMoveAndRotate(ref move, ref rotation, roll);
                                gridPos = controller.CubeGrid.PositionComp.GetPosition();
                            }

                            MyGridPhysicsStateGroup.ReadSubGrids(stream, timestamp,true,m_lowPositionOrientation,ref gridPos);
                        }
                    }
                }
            }
        }
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:38,代码来源:MyGridPositionVerificationStateGroup.cs

示例3: ServerRead

        protected override void ServerRead(VRage.Library.Collections.BitStream stream, ulong clientId, uint timestamp)
        {       
            base.ServerRead(stream, clientId, timestamp);
            bool clientHasCharacter = stream.ReadBool();
            if (clientHasCharacter)
            {
                MyEntity support;
                bool hasSupport = stream.ReadBool();
                Vector3D supportPosition = Vector3D.Zero;

                if (m_character != null)
                {
                    var physGroup = MyExternalReplicable.FindByObject(m_character).FindStateGroup<MyCharacterPhysicsStateGroup>();
                    if (physGroup != null)
                    {
                        m_support = MySupportHelper.FindSupportForCharacterAABB(m_character);
                        physGroup.SetSupport(MySupportHelper.FindPhysics(m_support));
                    }
                }

                 if (hasSupport)
                 {
                     long supportId = stream.ReadInt64();
                     bool apply = MyEntities.TryGetEntityById(supportId, out support);
                     supportPosition = stream.ReadVector3D();
                 }


                if(m_additionalServerClientData == null)
                {
                    m_additionalServerClientData = new Dictionary<ulong, ClientData>();
                }

                m_additionalServerClientData[clientId] = new ClientData() { HasSupport = hasSupport, SupportPosition = supportPosition };

                Vector3 move = new Vector3();
                move.X = stream.ReadHalf();
                move.Y = stream.ReadHalf();
                move.Z = stream.ReadHalf();

                Vector2 rotate = new Vector2();
                rotate.X = stream.ReadFloat();
                rotate.Y = stream.ReadFloat();

                float roll = stream.ReadFloat();

                MyCharacterMovementEnum MovementState = (MyCharacterMovementEnum)stream.ReadUInt16();
                MyCharacterMovementFlags MovementFlag = (MyCharacterMovementFlags)stream.ReadUInt16();

                bool Jetpack = stream.ReadBool();
                bool Dampeners = stream.ReadBool();
                bool Lights = stream.ReadBool(); // TODO: Remove
                bool Ironsight = stream.ReadBool();
                bool Broadcast = stream.ReadBool(); // TODO: Remove
                bool TargetFromCamera = stream.ReadBool();
                float headXAngle = stream.ReadFloat();
                float headYAngle = stream.ReadFloat();

                if(m_character == null)
                {
                    return;
                }

                if (m_character.IsUsing != null)
                {
                    return;
                }

                var jetpack = m_character.JetpackComp;
                if (jetpack != null)
                {
                    if (Jetpack != jetpack.TurnedOn)
                    {
                        jetpack.TurnOnJetpack(Jetpack, true);
                    }
                    if (Dampeners != jetpack.DampenersTurnedOn)
                    {
                        jetpack.EnableDampeners(Dampeners, false);
                    }
                }

                if (Lights != m_character.LightEnabled)
                {
                    m_character.EnableLights(Lights);
                }

                if (m_character.RadioBroadcaster != null && Broadcast != m_character.RadioBroadcaster.Enabled)
                {
                    m_character.EnableBroadcasting(Broadcast);
                }

                m_character.TargetFromCamera = TargetFromCamera;

                // Set client movement state directly and don't perform other operations
                // that may have side-effects to let server side Character.UpdateAfterSimulation()
                // perform exactly same operations as on client
                m_character.MovementFlags = MovementFlag;
                if (m_character.IsDead == false)
                {
                    m_character.SetCurrentMovementState(MovementState);
//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:101,代码来源:MyCharacterPositionVerificationStateGroup.cs

示例4: ServerRead

        protected override void ServerRead(VRage.Library.Collections.BitStream stream, ulong clientId, uint timestamp)
        {       
            base.ServerRead(stream, clientId, timestamp);
            bool clientHasCharacter = stream.ReadBool();
            if (clientHasCharacter)
            {
                MyEntity support;
                if (stream.ReadBool())
                {
                    bool apply = MyEntities.TryGetEntityById(stream.ReadInt64(), out support);

                    if (m_character != null)
                    {

                        var physGroup = MyExternalReplicable.FindByObject(m_character).FindStateGroup<MyCharacterPhysicsStateGroup>();
                        if (physGroup != null && apply)
                        {
                            physGroup.SetSupport(MySupportHelper.FindPhysics(support));
                        }
                    }
                }
               

                Vector3 move = new Vector3();
                move.X = stream.ReadHalf();
                move.Y = stream.ReadHalf();
                move.Z = stream.ReadHalf();

                Vector2 rotate = new Vector2();
                rotate.X = stream.ReadFloat();
                rotate.Y = stream.ReadFloat();

                float roll = stream.ReadFloat();

                MyCharacterMovementEnum MovementState = (MyCharacterMovementEnum)stream.ReadUInt16();
                MyCharacterMovementFlags MovementFlag = (MyCharacterMovementFlags)stream.ReadUInt16();

                bool Jetpack = stream.ReadBool();
                bool Dampeners = stream.ReadBool();
                bool Lights = stream.ReadBool(); // TODO: Remove
                bool Ironsight = stream.ReadBool();
                bool Broadcast = stream.ReadBool(); // TODO: Remove
                bool TargetFromCamera = stream.ReadBool();
                float headXAngle = stream.ReadFloat();
                float headYAngle = stream.ReadFloat();

                Quaternion rotation = Quaternion.Identity;

                if (Jetpack == false)
                {
                    rotation = stream.ReadQuaternionNorm();
                }

                if(m_character == null)
                {
                    return;
                }

                if (m_character.IsDead || m_character.IsUsing != null)
                {
                    return;
                }

                var jetpack = m_character.JetpackComp;
                if (jetpack != null)
                {
                    if (Jetpack != jetpack.TurnedOn)
                    {
                        jetpack.TurnOnJetpack(Jetpack, true);
                    }
                    if (Dampeners != jetpack.DampenersTurnedOn)
                    {
                        jetpack.EnableDampeners(Dampeners, false);
                    }
                }
                if (Lights != m_character.LightEnabled)
                {
                    m_character.EnableLights(Lights);
                }

                if (m_character.RadioBroadcaster != null && Broadcast != m_character.RadioBroadcaster.Enabled)
                {
                    m_character.EnableBroadcasting(Broadcast);
                }

                m_character.TargetFromCamera = TargetFromCamera;

                // Set client movement state directly and don't perform other operations
                // that may have side-effects to let server side Character.UpdateAfterSimulation()
                // perform exactly same operations as on client
                m_character.MovementFlags = MovementFlag;
                m_character.SetCurrentMovementState(MovementState);
                m_character.HeadLocalXAngle = headXAngle;
                m_character.HeadLocalYAngle = headYAngle;

               
                m_character.CacheMove(ref move, ref rotate, ref roll);

                if (Jetpack == false)
                {
//.........这里部分代码省略.........
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:101,代码来源:MyCharacterPositionVerificationStateGroup.cs


注:本文中的VRage.ReadFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。