void ReadParameters(NetworkReader reader)
        {
            ulong dirtyBits = reader.ReadPackedUInt64();

            for (int i = 0; i < namesParameters.Length; i++)
            {
                if ((dirtyBits & (1ul << i)) == 0)
                {
                    continue;
                }

                if (i < lastFloatParameters.Length)
                {
                    float newFloatValue = reader.ReadSingle();
                    m_Motion.motionGraph.SetFloat(Animator.StringToHash(namesParameters[i]), newFloatValue);
                }
                else if (i >= lastFloatParameters.Length &&
                         i < (lastFloatParameters.Length + lastIntParameters.Length))
                {
                    int newIntValue = reader.ReadPackedInt32();
                    m_Motion.motionGraph.SetInt(Animator.StringToHash(namesParameters[i]), newIntValue);
                }
                else if (i >= (lastFloatParameters.Length + lastIntParameters.Length) &&
                         i < (lastFloatParameters.Length + lastIntParameters.Length + lastSwitchParameters.Length))
                {
                    bool newBoolValue = reader.ReadBoolean();
                    m_Motion.motionGraph.SetSwitch(Animator.StringToHash(namesParameters[i]), newBoolValue);
                }
                else if (i >= (lastFloatParameters.Length + lastIntParameters.Length + lastSwitchParameters.Length) &&
                         i < (lastFloatParameters.Length + lastIntParameters.Length + lastSwitchParameters.Length + lastVectorParameters.Length))
                {
                    Vector3 newVectorValue = reader.ReadVector3();
                    m_Motion.motionGraph.SetVector(Animator.StringToHash(namesParameters[i]), newVectorValue);
                }
                else if (i >= (lastFloatParameters.Length + lastIntParameters.Length + lastSwitchParameters.Length + lastVectorParameters.Length) &&
                         i < (lastFloatParameters.Length + lastIntParameters.Length + lastSwitchParameters.Length + lastVectorParameters.Length + lastTransformParameters.Length))
                {
                    Transform newTransformValue = reader.ReadTransform();
                    m_Motion.motionGraph.SetTransform(Animator.StringToHash(namesParameters[i]), newTransformValue);
                }
            }
        }
예제 #2
0
        void ReadParameters(NetworkReader reader)
        {
            bool animatorEnabled = animator.enabled;
            // need to read values from NetworkReader even if animator is disabled

            ulong dirtyBits = reader.ReadUInt64();

            for (int i = 0; i < parameters.Length; i++)
            {
                if ((dirtyBits & (1ul << i)) == 0)
                {
                    continue;
                }

                AnimatorControllerParameter par = parameters[i];
                if (par.type == AnimatorControllerParameterType.Int)
                {
                    int newIntValue = reader.ReadInt32();
                    if (animatorEnabled)
                    {
                        animator.SetInteger(par.nameHash, newIntValue);
                    }
                }
                else if (par.type == AnimatorControllerParameterType.Float)
                {
                    float newFloatValue = reader.ReadSingle();
                    if (animatorEnabled)
                    {
                        animator.SetFloat(par.nameHash, newFloatValue);
                    }
                }
                else if (par.type == AnimatorControllerParameterType.Bool)
                {
                    bool newBoolValue = reader.ReadBoolean();
                    if (animatorEnabled)
                    {
                        animator.SetBool(par.nameHash, newBoolValue);
                    }
                }
            }
        }
예제 #3
0
 public override void OnDeserialize(NetworkReader reader, bool initialState)
 {
     if (initialState)
     {
         //This gets excecuted ONLY on CLIENT whenever a client connects for the first time to obtain the 'full' set of data
         //Debug.Log("RECEIVING INITIAL TILE-INFO: " + gameObject.name);
         this.n_TileType       = reader.ReadByte();
         this.n_lowerTurf      = reader.ReadByte();
         this.n_upperTurf      = reader.ReadByte();
         this.n_hasDisposal    = reader.ReadBoolean();
         this.n_disposalConfig = reader.ReadByte();
         this.n_hasBlue        = reader.ReadBoolean();
         this.n_blueConfig     = reader.ReadByte();
         this.n_hasRed         = reader.ReadBoolean();
         this.n_redConfig      = reader.ReadByte();
         SetAllTileData();
         //myTile.UpdateFromNetwork();
     }
     else
     {
         //This gets excecuted ONLY on client whenever updataPacket is invoked. the dirty bitmask itself is inaccesable
         // and should be send into the write/read buffer if its needed here to 'know' what is gonna change.
         // set dirtyBit Trigger 001<Tile>  010<Turf> 100<Pipe>
         ulong receivedDirtyBits = reader.ReadUInt64();
         Debug.Log("RECEIVING DELTA TILE-INFO: " + gameObject.name + " :: " + receivedDirtyBits.ToString("X"));
         if ((receivedDirtyBits & 0b001) != 0u)
         {
             this.n_TileType = reader.ReadByte();
             UpdateTile();
         }
         if ((receivedDirtyBits & 0b010) != 0u)
         {
             this.n_lowerTurf = reader.ReadByte();
             this.n_upperTurf = reader.ReadByte();
             UpdateTurf();
         }
         if ((receivedDirtyBits & 0b100) != 0u)
         {
             this.n_hasDisposal    = reader.ReadBoolean();
             this.n_disposalConfig = reader.ReadByte();
             this.n_hasBlue        = reader.ReadBoolean();
             this.n_blueConfig     = reader.ReadByte();
             this.n_hasRed         = reader.ReadBoolean();
             this.n_redConfig      = reader.ReadByte();
             UpdateUnderPipes(true);
         }
     }
 }
예제 #4
0
        void ReadParameters(NetworkReader reader, bool autoSend)
        {
            // store the animator parameters in a variable - the "Animator.parameters" getter allocates
            // a new parameter array every time it is accessed so we should avoid doing it in a loop
            AnimatorControllerParameter[] parameters = m_Animator.parameters;

            for (int i = 0; i < parameters.Length; i++)
            {
                if (autoSend && !GetParameterAutoSend(i))
                {
                    continue;
                }

                AnimatorControllerParameter par = parameters[i];
                if (par.type == AnimatorControllerParameterType.Int)
                {
                    int newValue = (int)reader.ReadPackedUInt32();
                    m_Animator.SetInteger(par.nameHash, newValue);

                    SetRecvTrackingParam(par.name + ":" + newValue, i);
                }

                if (par.type == AnimatorControllerParameterType.Float)
                {
                    float newFloatValue = reader.ReadSingle();
                    m_Animator.SetFloat(par.nameHash, newFloatValue);

                    SetRecvTrackingParam(par.name + ":" + newFloatValue, i);
                }

                if (par.type == AnimatorControllerParameterType.Bool)
                {
                    bool newBoolValue = reader.ReadBoolean();
                    m_Animator.SetBool(par.nameHash, newBoolValue);

                    SetRecvTrackingParam(par.name + ":" + newBoolValue, i);
                }
            }
        }
예제 #5
0
        void ReadParameters(NetworkReader reader)
        {
            // need to read values from NetworkReader even if animator is disabled

            ulong dirtyBits = reader.ReadPackedUInt64();

            for (int i = 0; i < parameters.Length; i++)
            {
                if ((dirtyBits & (1ul << i)) == 0)
                {
                    continue;
                }

                AnimatorControllerParameter par = parameters[i];
                switch (par.type)
                {
                case AnimatorControllerParameterType.Int:
                {
                    int newIntValue = reader.ReadPackedInt32();
                    SetInteger(par, newIntValue);
                    break;
                }

                case AnimatorControllerParameterType.Float:
                {
                    float newFloatValue = reader.ReadSingle();
                    SetFloat(par, newFloatValue);
                    break;
                }

                case AnimatorControllerParameterType.Bool:
                {
                    bool newBoolValue = reader.ReadBoolean();
                    SetBool(par, newBoolValue);
                    break;
                }
                }
            }
        }
예제 #6
0
        void ReadParameters(NetworkReader reader)
        {
            ulong dirtyBits = reader.ReadPackedUInt64();

            for (int i = 0; i < parameters.Length; i++)
            {
                if ((dirtyBits & (1ul << i)) == 0)
                {
                    continue;
                }

                AnimatorControllerParameter par = parameters[i];
                if (par.type == AnimatorControllerParameterType.Int)
                {
                    int newIntValue = reader.ReadPackedInt32();
                    animator.SetInteger(par.nameHash, newIntValue);
                }
                else if (par.type == AnimatorControllerParameterType.Float)
                {
                    float newFloatValue = reader.ReadSingle();
                    // If interpolating, set the target. Otherwise, set the value immediately.
                    if (interpolateFloatParameters)
                    {
                        floatParametersTargets[i] = newFloatValue;
                    }
                    else
                    {
                        animator.SetFloat(par.nameHash, newFloatValue);
                    }
                }
                else if (par.type == AnimatorControllerParameterType.Bool)
                {
                    bool newBoolValue = reader.ReadBoolean();
                    animator.SetBool(par.nameHash, newBoolValue);
                }
            }
        }
예제 #7
0
 protected override bool DeserializeItem(NetworkReader reader) => reader.ReadBoolean();
예제 #8
0
 public override void Deserialize(NetworkReader reader)
 {
     netId     = reader.ReadPackedUInt32();
     authority = reader.ReadBoolean();
 }
예제 #9
0
 public void Deserialize(NetworkReader reader)
 {
     sceneName      = reader.ReadString();
     sceneOperation = (SceneOperation)reader.ReadByte();
     customHandling = reader.ReadBoolean();
 }
예제 #10
0
 public override void Deserialize(NetworkReader reader)
 {
     netId     = reader.ReadNetworkId();
     authority = reader.ReadBoolean();
 }
예제 #11
0
 protected override bool DeserializeItem(NetworkReader reader)
 {
     return(reader.ReadBoolean());
 }