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


C# NetworkReader.ReadSingle方法代码示例

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


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

示例1: Deserialize

 public override void Deserialize(NetworkReader reader)
 {
     this.netId = reader.ReadNetworkId();
     this.stateHash = (int) reader.ReadPackedUInt32();
     this.normalizedTime = reader.ReadSingle();
     this.parameters = reader.ReadBytesAndSize();
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:7,代码来源:AnimationMessage.cs

示例2: OnDeserialize

 public override void OnDeserialize(NetworkReader reader, bool initialState)
 {
     base.OnDeserialize (reader, initialState);
     float time = 0f;
     try {
         time = reader.ReadSingle ();
     } catch (System.Exception e) {
         Debug.LogError ("Custom deserialization exception.");
         Debug.LogError (e);
     }
     animator.playbackTime = time;
 }
开发者ID:doctorpangloss,项目名称:Cordon2,代码行数:12,代码来源:SyncAnimatorOnLoad.cs

示例3: Deserialize

    public override void Deserialize(NetworkReader reader) {
        //Get the no of inputs received
        int count = reader.ReadInt32();

        //Prepaare list
        if (inputsList != null) {
            inputsList.Clear(); //Detatch prev elements
        }
        inputsList = new List<Inputs>(); //Detatch prev mem

        //Build all inputs
        for (int i = 0; i < count; i++){
            //Create
            Inputs input = new Inputs();

            //Deserialize individually
            input.crouch = reader.ReadBoolean();
            input.jump = reader.ReadBoolean();
            input.move = reader.ReadBoolean();
            input.pitch = reader.ReadSingle();
            input.rotate = reader.ReadBoolean();
            input.timeStamp = reader.ReadDouble();
            input.walk = reader.ReadBoolean();
            bool[] wasd = new bool[4];
            wasd[0] = reader.ReadBoolean();
            wasd[1] = reader.ReadBoolean();
            wasd[2] = reader.ReadBoolean();
            wasd[3] = reader.ReadBoolean();
            input.wasd = wasd;
            input.yaw = reader.ReadSingle();

            //Add to the message list
            inputsList.Add(input);

            //Check if is the last input and register stamp
            if(i == count - 1) {
                stamp = input.timeStamp;
            }
        }
    }
开发者ID:lucasmontec,项目名称:UnetCharacterController,代码行数:40,代码来源:InputListMessage.cs

示例4: ReadAngle

 private static float ReadAngle(NetworkReader reader, NetworkTransform.CompressionSyncMode compression)
 {
   switch (compression)
   {
     case NetworkTransform.CompressionSyncMode.None:
       return reader.ReadSingle();
     case NetworkTransform.CompressionSyncMode.Low:
       return (float) reader.ReadInt16();
     case NetworkTransform.CompressionSyncMode.High:
       return (float) reader.ReadInt16();
     default:
       return 0.0f;
   }
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:14,代码来源:NetworkTransform.cs

示例5: ReadParameters

 private void ReadParameters(NetworkReader reader, bool autoSend)
 {
     for (int i = 0; i < this.m_Animator.parameters.Length; i++)
     {
         if (!autoSend || this.GetParameterAutoSend(i))
         {
             AnimatorControllerParameter parameter = this.m_Animator.parameters[i];
             if (parameter.type == AnimatorControllerParameterType.Int)
             {
                 int num2 = (int) reader.ReadPackedUInt32();
                 this.m_Animator.SetInteger(parameter.nameHash, num2);
                 this.SetRecvTrackingParam(parameter.name + ":" + num2, i);
             }
             if (parameter.type == AnimatorControllerParameterType.Float)
             {
                 float num3 = reader.ReadSingle();
                 this.m_Animator.SetFloat(parameter.nameHash, num3);
                 this.SetRecvTrackingParam(parameter.name + ":" + num3, i);
             }
             if (parameter.type == AnimatorControllerParameterType.Bool)
             {
                 bool flag = reader.ReadBoolean();
                 this.m_Animator.SetBool(parameter.nameHash, flag);
                 this.SetRecvTrackingParam(parameter.name + ":" + flag, i);
             }
         }
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:28,代码来源:NetworkAnimator.cs

示例6: OnDeserialize

 public override void OnDeserialize(NetworkReader reader, bool initialState)
 {
     if (initialState)
     {
         int stateNameHash = reader.ReadInt32();
         float normalizedTime = reader.ReadSingle();
         this.ReadParameters(reader, false);
         this.m_Animator.Play(stateNameHash, 0, normalizedTime);
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:10,代码来源:NetworkAnimator.cs

示例7: ReadParameters

 private void ReadParameters(NetworkReader reader, bool autoSend)
 {
   for (int index = 0; index < this.m_Animator.parameters.Length; ++index)
   {
     if (!autoSend || this.GetParameterAutoSend(index))
     {
       AnimatorControllerParameter parameter = this.m_Animator.parameters[index];
       if (parameter.type == AnimatorControllerParameterType.Int)
       {
         int num = (int) reader.ReadPackedUInt32();
         this.m_Animator.SetInteger(parameter.nameHash, num);
         this.SetRecvTrackingParam(parameter.name + ":" + (object) num, index);
       }
       if (parameter.type == AnimatorControllerParameterType.Float)
       {
         float num = reader.ReadSingle();
         this.m_Animator.SetFloat(parameter.nameHash, num);
         this.SetRecvTrackingParam(parameter.name + ":" + (object) num, index);
       }
       if (parameter.type == AnimatorControllerParameterType.Bool)
       {
         bool flag = reader.ReadBoolean();
         this.m_Animator.SetBool(parameter.nameHash, flag);
         this.SetRecvTrackingParam(parameter.name + ":" + (object) flag, index);
       }
     }
   }
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:28,代码来源:NetworkAnimator.cs

示例8: FakeOnUnserializeVars

 // ShipControl
 public void FakeOnUnserializeVars(NetworkReader reader, bool initialState)
 {
     int num = (int)reader.ReadPackedUInt32();
     if ((num & 1) != 0)
     {
     if (initialState)
     {
         this.health = (int)reader.ReadPackedUInt32();
     }
     else
     {
         this.OnHealth((int)reader.ReadPackedUInt32());
     }
     }
     if ((num & 2) != 0)
     {
     this.energy = (int)reader.ReadPackedUInt32();
     }
     if ((num & 4) != 0)
     {
     this.speedBufTimer = reader.ReadSingle();
     }
     if ((num & 8) != 0)
     {
     this.rotateBufTimer = reader.ReadSingle();
     }
     if ((num & 16) != 0)
     {
     this.tripleshotTimer = reader.ReadSingle();
     }
     if ((num & 32) != 0)
     {
     this.doubleshotTimer = reader.ReadSingle();
     }
     if ((num & 64) != 0)
     {
     this.quadDamageTimer = reader.ReadSingle();
     }
     if ((num & 128) != 0)
     {
     this.bounceTimer = reader.ReadSingle();
     }
     if ((num & 256) != 0)
     {
     this.playerName = reader.ReadString();
     }
     if ((num & 512) != 0)
     {
     this.thrusting = reader.ReadSingle();
     }
 }
开发者ID:pingualoty,项目名称:BHCIHack,代码行数:52,代码来源:ShipControl.cs

示例9: ReadAngle

        private static float ReadAngle(NetworkReader reader, CompressionSyncMode compression)
        {
            switch (compression)
            {
                case CompressionSyncMode.None:
                    return reader.ReadSingle();

                case CompressionSyncMode.Low:
                    return (float) reader.ReadInt16();

                case CompressionSyncMode.High:
                    return (float) reader.ReadInt16();
            }
            return 0f;
        }
开发者ID:randomize,项目名称:VimConfig,代码行数:15,代码来源:NetworkTransform.cs

示例10: Deserialize

            public override void Deserialize(NetworkReader reader)
            {
                name = reader.ReadString();

                var isNull = reader.ReadBoolean();
                if (isNull){
                    value = null;
                    return;
                }

                var typeName = reader.ReadString();
                var t = System.Type.GetType(typeName);

                if (t == typeof(string)){
                    value = reader.ReadString();
                    return;
                }
                if (t == typeof(bool)){
                    value = reader.ReadBoolean();
                    return;
                }
                if (t == typeof(int)){
                    value = reader.ReadInt32();
                    return;
                }
                if (t == typeof(float)){
                    value = reader.ReadSingle();
                    return;
                }
                if (t == typeof(Color)){
                    value = reader.ReadColor();
                    return;
                }
                if (t == typeof(Vector2)){
                    value = reader.ReadVector2();
                    return;
                }
                if (t == typeof(Vector3)){
                    value = reader.ReadVector3();
                    return;
                }
                if (t == typeof(Vector4)){
                    value = reader.ReadVector4();
                    return;
                }
                if (t == typeof(Quaternion)){
                    value = reader.ReadQuaternion();
                    return;
                }
                if (t == typeof(GameObject)){
                    value = reader.ReadGameObject();
                    return;
                }
                if (typeof(Component).RTIsAssignableFrom(t)){
                    var go = reader.ReadGameObject();
                    if (go != null){
                        value = go.GetComponent(t);
                    }
                    return;
                }
            }
开发者ID:nemish,项目名称:cubematters,代码行数:61,代码来源:SyncBlackboard.cs

示例11: ReadAngle

 private static float ReadAngle(NetworkReader reader, CompressionSyncMode compression)
 {
     if (compression != CompressionSyncMode.None)
     {
         if (compression == CompressionSyncMode.Low)
         {
             return (float) reader.ReadInt16();
         }
         if (compression == CompressionSyncMode.High)
         {
             return (float) reader.ReadInt16();
         }
     }
     else
     {
         return reader.ReadSingle();
     }
     return 0f;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:19,代码来源:NetworkTransform.cs


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