Serialize() публичный Метод

public Serialize ( NetworkPlayer &value ) : void
value NetworkPlayer
Результат void
Пример #1
0
    public int playerIndex = 0; // Player index of driver who spawned fake item box

    #endregion Fields

    #region Methods

    // Send data over network
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 position = Vector3.zero;
        Vector3 forwardVector = Vector3.zero;
        Vector3 upVector = Vector3.zero;
        if (stream.isWriting)
        {
            // Sending data...
            position = this.transform.position;
            forwardVector = this.transform.forward;
            upVector = this.transform.up;
            stream.Serialize(ref position);
            stream.Serialize(ref forwardVector);
            stream.Serialize(ref upVector);
            stream.Serialize(ref moveDirection);
            stream.Serialize(ref this.playerIndex);
        }
        else
        {
            // Receiving data...
            stream.Serialize(ref position);
            stream.Serialize(ref forwardVector);
            stream.Serialize(ref upVector);
            this.transform.position = position;
            this.transform.rotation = Quaternion.LookRotation(forwardVector, upVector);
            stream.Serialize(ref moveDirection);
            stream.Serialize(ref this.playerIndex);
        }
    }
Пример #2
0
    //Rigidbody
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        var lIsKinematic = true;
        var lPosition = Vector3.zero;
        var lRot = Quaternion.identity;

        if (stream.isWriting)
        {
            lPosition = transform.position;
            lRot = transform.rotation;
            lIsKinematic = rigidbody.isKinematic;
            //lBoxPos = _supplyBox.transform.position;
        }

        stream.Serialize(ref lIsKinematic);
        stream.Serialize(ref lPosition);
        stream.Serialize(ref lRot);
        //stream.Serialize(ref lBoxPos);

        if (stream.isReading)
        {
            transform.position = lPosition;
            transform.rotation = lRot;
            rigidbody.isKinematic = lIsKinematic;
        }

        if(!lIsKinematic)
        {
            networkView.observed = rigidbody;
            Destroy(this);
        }
    }
Пример #3
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        float net_currentHealth = 0;
        float net_maxHealth = 0;
        bool net_isTargeted = false;

        if (stream.isWriting)
        {
            net_currentHealth = currentHealth;
            net_maxHealth = maxHealth;
            net_isTargeted = isTargeted;

            stream.Serialize(ref net_currentHealth);
            stream.Serialize(ref net_maxHealth);
            stream.Serialize(ref net_isTargeted);
        }
        else if (stream.isReading)
        {
            stream.Serialize(ref net_currentHealth);
            stream.Serialize(ref net_maxHealth);
            stream.Serialize(ref net_isTargeted);

            currentHealth = net_currentHealth;
            maxHealth = net_maxHealth;
            isTargeted = net_isTargeted;
        }
    }
Пример #4
0
    private void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        if (stream.isWriting)
        {
            Debug.Log("Writing.");

            Vector3 pos = this.transform.position;
            Vector3 orientation = this.transform.eulerAngles;

            stream.Serialize(ref pos);
            stream.Serialize(ref orientation);
        }
        else
        {
            Debug.Log("Receiving.");

            Vector3 pos = Vector3.zero;
            Vector3 orientation = Vector3.zero;

            stream.Serialize(ref pos);
            stream.Serialize(ref orientation);

            this.transform.position = pos;
            this.transform.eulerAngles = orientation;
        }
    }
Пример #5
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 syncPosition = Vector3.zero;
        Vector3 syncVelocity = Vector3.zero;
        if (stream.isWriting)
        {
            syncPosition = GetComponent<Rigidbody>().position;
            stream.Serialize(ref syncPosition);

            syncPosition = GetComponent<Rigidbody>().velocity;
            stream.Serialize(ref syncVelocity);

            //finPos = GetComponent<Rigidbody>().transform;
            //Debug.Log("FinPos: " + finPos);
        }
        else
        {
            stream.Serialize(ref syncPosition);
            stream.Serialize(ref syncVelocity);

            syncTime = 0f;
            syncDelay = Time.time - lastSynchronizationTime;
            lastSynchronizationTime = Time.time;

            syncEndPosition = syncPosition + syncVelocity * syncDelay;
            syncStartPosition = GetComponent<Rigidbody>().position;
        }
    }
Пример #6
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        if (initialized) {
            Vector3 syncPosition = Vector3.zero;
            Quaternion syncRotation = Quaternion.identity;
            Vector3 syncVelocity = Vector3.zero;
            float syncHealth = 0f;

            if (stream.isWriting) {
                syncPosition = transform.position;
                syncRotation = transform.rotation;
                syncVelocity = rigidbody.velocity;
                syncHealth = playerDefense.health;
            }

            stream.Serialize(ref syncPosition);
            stream.Serialize(ref syncRotation);
            stream.Serialize(ref syncVelocity);
            stream.Serialize(ref syncHealth);

            if (stream.isReading) {
                syncTime = 0f;
                float currentTime = Time.time;
                syncDelay = currentTime - lastSynchronizationTime;
                lastSynchronizationTime = currentTime;

                startSyncPosition = transform.position;
                startSyncRotation = transform.rotation;
                endSyncPosition = syncPosition + syncVelocity * syncDelay;
                endSyncRotation = syncRotation;
                this.syncHealth = syncHealth;
            }
        }
    }
Пример #7
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 tempPos = Vector3.zero;
        Quaternion tempRot = Quaternion.identity;

        if((Network.isServer)&&(stream.isWriting))
        {
            //Debug.Log("Hellow");

            tempPos = transform.position;
            tempRot = transform.rotation;

            stream.Serialize(ref tempPos);
            stream.Serialize(ref tempRot);

        }
        else if(Network.isClient)
        {

            stream.Serialize(ref  tempPos);
            stream.Serialize(ref tempRot);

            transform.position = tempPos;
            transform.rotation = tempRot;

        }
    }
Пример #8
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 syncPosition = Vector3.zero;
        if ((networkView.isMine) && stream.isWriting)
        {
            //Write data to stream
            syncPosition = transform.position;
            stream.Serialize(ref syncPosition);
            print (gameObject.name);
        }
        else
        {
            //Get data from stream
            stream.Serialize(ref syncPosition);

            //Calculate sync delay (ping, kind of)
            syncDelay = Time.time - lastSynchronizationTime;
            lastSynchronizationTime = Time.time;
            NetworkManager.changeMenuDebugStatus("syncDelay: "+syncDelay);

            //Set new start and end position for movement interpolation
            syncStartPosition = syncEndPosition;
            syncEndPosition = syncPosition;
            print (syncStartPosition);
            print ("end: "+syncEndPosition);
        }
    }
    void OnSerializeNetworkView (BitStream stream, NetworkMessageInfo info)
    {
        var pos = observedTransform.position;
        var rot = observedTransform.rotation;
        var target = unitController.target;
        var targetWaypoint = unitController.targetWaypoint;
        var health = unitController.health;

        if (stream.isWriting)
        {
            stream.Serialize(ref pos);
            stream.Serialize(ref rot);
            stream.Serialize(ref target);
            stream.Serialize(ref targetWaypoint);
            stream.Serialize(ref health);
        }
        else
        {
            stream.Serialize(ref pos);
            stream.Serialize(ref rot);
            stream.Serialize(ref target);
            stream.Serialize(ref targetWaypoint);
            stream.Serialize(ref health);

            unitController.serverPos = pos;
            unitController.serverRot = rot;
            unitController.target = target;
            unitController.targetWaypoint = targetWaypoint;
            unitController.health = health;
        }
    }
Пример #10
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 syncPosition = Vector3.zero;
        Vector3 syncVelocity = Vector3.zero;
        if (stream.isWriting)
        {
            syncPosition = rigidbody.position;
            stream.Serialize(ref syncPosition);

            syncPosition = rigidbody.velocity;
            stream.Serialize(ref syncVelocity);
        }
        else
        {
            stream.Serialize(ref syncPosition);
            stream.Serialize(ref syncVelocity);

            syncTime = 0f;
            syncDelay = Time.time - lastSynchronizationTime;
            lastSynchronizationTime = Time.time;

            syncEndPosition = syncPosition + syncVelocity * syncDelay;
            syncStartPosition = rigidbody.position;
        }
    }
Пример #11
0
 public virtual void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
 {
     if (_animator != null) {
         foreach (AnimatorControllerParameter param in _animator.parameters) {
             AnimatorControllerParameterType paramType = param.type;
             switch (paramType) {
             case AnimatorControllerParameterType.Bool:
                 bool boolParam = _animator.GetBool (param.nameHash);
                 stream.Serialize (ref boolParam);
                 if (stream.isReading) {
                     _animator.SetBool (param.nameHash, boolParam);
                 }
                 break;
             case AnimatorControllerParameterType.Float:
                 float floatParam = _animator.GetFloat (param.nameHash);
                 stream.Serialize (ref floatParam);
                 if (stream.isReading) {
                     _animator.SetFloat (param.nameHash, floatParam);
                 }
                 break;
             case AnimatorControllerParameterType.Int:
                 int intParam = _animator.GetInteger (param.nameHash);
                 stream.Serialize (ref intParam);
                 if (stream.isReading) {
                     _animator.SetInteger (param.nameHash, intParam);
                 }
                 break;
             }
         }
     }
 }
Пример #12
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        BoardLocation newLocation= new BoardLocation(new IntVector2(0,0), new IntVector2(0,0));
        int maxSpeed = 0;
        IntVector2 direction = new IntVector2(0,0);
        BoardLocation lastBoardLocation = new BoardLocation(new IntVector2( 0, 0), new IntVector2(0,0));

        if (stream.isWriting)
        {
            newLocation = this.boardLocation;
            maxSpeed = this.maxSpeed;
            direction = this.direction;
            lastBoardLocation = this.lastBoardLocation;

            newLocation.Serialize( stream );
            stream.Serialize( ref maxSpeed );
            direction.Serialize( stream );
            lastBoardLocation.Serialize( stream );
        }
        else
        {
            newLocation.DeSerialize( stream );
            stream.Serialize( ref maxSpeed );
            direction.DeSerialize( stream );
            lastBoardLocation.DeSerialize( stream );

            this.boardLocation = newLocation;
            this.maxSpeed = maxSpeed;
            this.direction = direction;
            this.lastBoardLocation = lastBoardLocation;
        }
    }
Пример #13
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 syncPosition = Vector3.zero;
        Quaternion rot = Quaternion.identity;

        if (stream.isWriting)
        {

            syncPosition = transform.position;
            rot = transform.rotation;

            stream.Serialize(ref syncPosition);

            stream.Serialize(ref rot);
        }
        else
        {
            stream.Serialize(ref syncPosition);
            stream.Serialize(ref rot);

            syncTime = 0f;
            syncDelay = Time.time - lastSynchronizationTime;
            lastSynchronizationTime = Time.time;

            syncStartPosition = transform.position;
            syncEndPosition = syncPosition;

            qSrot = transform.rotation;
            qErot = rot;
        }
    }
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        if (stream.isWriting)
        {
            //  Vector3 pos = transform.position;
            Quaternion rot = transform.rotation;
            //   int _animState = (int)animState;

            //   stream.Serialize(ref pos);
            stream.Serialize(ref rot);
            //   stream.Serialize(ref _animState);

        }
        else
        {
            //   Vector3 revPos = Vector3.zero;
            Quaternion revRot = Quaternion.identity;
            //  int _animState = 0;

            //    stream.Serialize(ref revPos);
            stream.Serialize(ref revRot);
            //  stream.Serialize(ref _animState);

            //     currPos = revPos;
            currRot = revRot;
            //   animState = (AnimState)_animState;
        }
    }
    //Sends or Recieves Serialized variables over the network.
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        //Variable to be used over the network.
        Vector3 syncPosition = Vector3.zero;

        //If you're the owner of the object you are sending the objects position over the network.
        if(stream.isWriting)
        {
            //Set syncPosition to this objects current position.
            syncPosition = transform.position;
            //Send the position over the network.
            stream.Serialize(ref syncPosition);
        }
        //You're recieving the position from the Owner.
        else
        {
            //Serialize the new incoming position.
            stream.Serialize(ref syncPosition);

            syncTime = 0.0f;
            syncDelay = Time.time - lastSyncTime;
            lastSyncTime = Time.time;

            syncStartPosition = transform.position;
            syncEndPosition = syncPosition;
        }
    }
Пример #16
0
    public void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 pos = observedTransform.position;
        Quaternion rot = observedTransform.rotation;

        if (stream.isWriting) {
            //Debug.Log("Server is writing");
            stream.Serialize(ref pos);
            stream.Serialize(ref rot);
        }
        else {
            //This code takes care of the local client!
            stream.Serialize(ref pos);
            stream.Serialize(ref rot);
            receiver.serverPosition = pos;
            receiver.serverRotation = rot;
            //Smoothly correct clients position
            //receiver.lerpToTarget();

            //Take care of data for interpolating remote objects movements
            // Shift up the buffer
            for ( int i = serverStateBuffer.Length - 1; i >= 1; i-- ) {
                serverStateBuffer[i] = serverStateBuffer[i-1];
            }
            //Override the first element with the latest server info
            serverStateBuffer[0] = new NetworkState((float)info.timestamp, pos, rot);
        }
    }
Пример #17
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        //locateMarkersAndLimbs();
        Vector3 tempPos = Vector3.zero;
        Quaternion tempRot = Quaternion.identity;

        //ADD THE parentP2 changes here as well! To stop jitter!!

        if((Network.isServer)&&(stream.isWriting))
        {
            if(!parentP1)
            {
                tempPos = transform.position;
                tempRot = transform.rotation;

                stream.Serialize(ref tempPos);
                stream.Serialize(ref tempRot);
            }

        }
        if(Network.isClient)
        {
            if(!parentP1)
            {
                stream.Serialize(ref tempPos);
                stream.Serialize(ref tempRot);

                transform.position = tempPos;
                transform.rotation = tempRot;
            }

        }
    }
Пример #18
0
    public void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 pos = observedTransform.position;
        Quaternion rot = observedTransform.rotation;

        if(stream.isWriting) {
            stream.Serialize(ref pos);
            stream.Serialize(ref rot);
        }
        else{
            stream.Serialize(ref pos);
            stream.Serialize(ref rot);
            reciever.serverPos = pos;
            reciever.serverRot = rot;

            reciever.lerpToTarget();

            for( int i = serverStateBuffer.Length - 1; i >= 1;i--){
                serverStateBuffer[i] = serverStateBuffer[i-1];
            }

            serverStateBuffer[0] = new NetState();
            serverStateBuffer[0].setState((float)info.timestamp, pos, rot);
        }
    }
    /* This function is automatically called every time it sends or receives datas.
    (To use for data that constantly changed) */
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Quaternion syncRotation = Quaternion.identity;

        // The player is writing to the stream (= he moves its own Character...)
        if (stream.isWriting)
        {
            syncRotation = transform.localRotation;
            stream.Serialize(ref syncRotation);
        }
        // The ClientInstance of the player's opponent need to be moved
        else
        {
            stream.Serialize(ref syncRotation);

            // Interpolation : smoothing the transition from the old to the new data values
            syncTime = 0f;
            syncDelay = Time.time - lastSynchronizationTime;
            lastSynchronizationTime = Time.time;

            // Prediction : the rotation is "updated" before the new data is received
            syncStartRotation = transform.localRotation;
            syncEndRotation = syncRotation;
        }
    }
 void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
 {
     if (stream.isWriting)
     {
         Vector3 pos = transform.localPosition;
         Quaternion rot = transform.localRotation;
         stream.Serialize(ref pos);
         stream.Serialize(ref rot);
     }
     else
     {
         Vector3 pos = Vector3.zero;
         Quaternion rot = Quaternion.identity;
         stream.Serialize(ref pos);
         stream.Serialize(ref rot);
         for (int i = m_BufferedState.Length - 1; i >= 1; i--)
         {
             m_BufferedState[i] = m_BufferedState[i - 1];
         }
         State state;
         state.timestamp = info.timestamp;
         state.pos = pos;
         state.rot = rot;
         m_BufferedState[0] = state;
         m_TimestampCount = Mathf.Min(m_TimestampCount + 1, m_BufferedState.Length);
         for (int i = 0; i < m_TimestampCount - 1; i++)
         {
             if (m_BufferedState[i].timestamp < m_BufferedState[i + 1].timestamp)
                 Debug.Log("State inconsistent");
         }
     }
 }
Пример #21
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 syncPosition = Vector3.zero;
        Quaternion syncRotation = Quaternion.identity;
        Vector3 syncVelocity = Vector3.zero;
        if (stream.isWriting)
        {
            syncPosition = transform.position;
            stream.Serialize(ref syncPosition);

            syncRotation = transform.rotation;
            stream.Serialize(ref syncRotation);

            syncVelocity = controller.velocity;
            stream.Serialize(ref syncVelocity);
        }
        else
        {
            stream.Serialize(ref syncPosition);
            stream.Serialize(ref syncRotation);
            stream.Serialize(ref syncVelocity);

            syncTime = 0f;
            syncDelay = Time.time - lastSynchronizationTime;
            lastSynchronizationTime = Time.time;

            syncEndPosition = syncPosition + syncVelocity * syncDelay;
            syncStartPosition = transform.position;

            syncEndRotation = syncRotation;
            syncStartRotation = transform.rotation;
        }
    }
Пример #22
0
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        Vector3 syncDest = Vector3.zero;
        Vector3 syncPos = Vector3.zero;
        if (stream.isWriting && Network.isServer)
        {
            syncDest = destination;
            syncPos = this.gameObject.transform.position;
            stream.Serialize(ref syncDest);
            stream.Serialize(ref syncPos);
        }
        else if (stream.isReading)
        {
            stream.Serialize(ref syncDest);
            stream.Serialize(ref syncPos);

            destination = syncDest;
            if (agent != null)
                agent.SetDestination (destination);

            /*
            Vector3 diffPos = this.gameObject.transform.position - syncPos;
            if (diffPos.sqrMagnitude >= 1){
                this.gameObject.transform.position = syncPos;
            }
            */
        }
    }
Пример #23
0
    // Update is called once per frame
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        {
            Vector3 position = rigidbody.position;
            Vector3 forward = transform.forward;
            Vector3 velocity = rigidbody.velocity;
            Vector3 angularVelocity = rigidbody.angularVelocity;

            if(stream.isWriting)
            {
                stream.Serialize(ref position);
                stream.Serialize(ref forward);
                stream.Serialize(ref velocity);
                stream.Serialize(ref angularVelocity);
            }
            else
            {
                stream.Serialize(ref position);
                targetPosition = position;

                stream.Serialize(ref forward);
                targetForward = forward;

                stream.Serialize(ref velocity);
                speed = velocity;

                stream.Serialize(ref angularVelocity);
                angularSpeed = angularVelocity;
            }
        }
    }
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        // Send data to server
        if (stream.isWriting)
        {
            Vector3 pos = transform.position;
            Quaternion rot = transform.rotation;
            bool swinging = false;

        //			if(animator){
        //				AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
        //				if(stateInfo.nameHash == slash1AnimationNameHash || stateInfo.nameHash == slash2AnimationNameHash){
        //					swinging = true;
        //				}
        //			}

            stream.Serialize(ref pos);
            stream.Serialize(ref rot);
        //			stream.Serialize(ref swinging);
        }
        // Read data from remote client
        else
        {
            Vector3 pos = Vector3.zero;
            Quaternion rot = Quaternion.identity;
            bool hasSwing = false;

            stream.Serialize(ref pos);
            stream.Serialize(ref rot);
        //			stream.Serialize(ref hasSwing);

            // Shift the buffer sideways, deleting state 20
            for (int i=m_BufferedState.Length-1;i>=1;i--)
            {
                m_BufferedState[i] = m_BufferedState[i-1];
            }

            // Record current state in slot 0
            State state;
            state.timestamp = info.timestamp;
            state.pos = pos;
            state.rot = rot;
        //			state.swinging = hasSwing;
            m_BufferedState[0] = state;

            // Update used slot count, however never exceed the buffer size
            // Slots aren't actually freed so this just makes sure the buffer is
            // filled up and that uninitalized slots aren't used.
            m_TimestampCount = Mathf.Min(m_TimestampCount + 1, m_BufferedState.Length);

            // Check if states are in order, if it is inconsistent you could reshuffel or
            // drop the out-of-order state. Nothing is done here
            for (int i=0;i<m_TimestampCount-1;i++)
            {
                if (m_BufferedState[i].timestamp < m_BufferedState[i+1].timestamp)
                    Debug.Log("State inconsistent");
            }
        }
    }
Пример #25
0
 void OnSerializeNetworkView(BitStream stream)
 {
     p = rigidbody.position;
     r = rigidbody.rotation;
     m = 0;
     stream.Serialize(ref p);
     stream.Serialize(ref r);
     stream.Serialize(ref m);
 }
    void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        // Send data to server
        if (stream.isWriting)
        {
            Vector3 pos = transform.position;
            Quaternion rot = transform.rotation;
            //Vector3 velocity = Vector3.zero;  //rigidbody.velocity;
            //Vector3 angularVelocity = Vector3.zero; // rigidbody.angularVelocity;

            stream.Serialize(ref pos);
            //stream.Serialize(ref velocity);
            stream.Serialize(ref rot);
            //stream.Serialize(ref angularVelocity);
        }
        // Read data from remote client
        else
        {
            Vector3 pos = Vector3.zero;
            Vector3 velocity = Vector3.zero;
            Quaternion rot = Quaternion.identity;
            Vector3 angularVelocity = Vector3.zero;
            stream.Serialize(ref pos);
            //stream.Serialize(ref velocity);
            stream.Serialize(ref rot);
            //stream.Serialize(ref angularVelocity);

            // Shift the buffer sideways, deleting state 20
            for (int i = m_BufferedState.Length - 1; i >= 1; i--)
            {
                m_BufferedState[i] = m_BufferedState[i - 1];
            }

            // Record current state in slot 0
            State state;
            state.timestamp = info.timestamp;
            state.pos = pos;
            state.velocity = velocity;
            state.rot = rot;
            state.angularVelocity = angularVelocity;
            m_BufferedState[0] = state;

            // Update used slot count, however never exceed the buffer size
            // Slots aren't actually freed so this just makes sure the buffer is
            // filled up and that uninitalized slots aren't used.
            m_TimestampCount = Mathf.Min(m_TimestampCount + 1, m_BufferedState.Length);

            // Check if states are in order, if it is inconsistent you could reshuffel or
            // drop the out-of-order state. Nothing is done here
            for (int i = 0; i < m_TimestampCount - 1; i++)
            {
                if (m_BufferedState[i].timestamp < m_BufferedState[i + 1].timestamp)
                    Debug.Log("State inconsistent");
            }
        }
    }
Пример #27
0
	void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info){
		if(stream.isWriting){
			int owner_id = owner_id_;
			stream.Serialize(ref owner_id);
		} else {
			int owner_id = -1;
			stream.Serialize(ref owner_id);
			owner_id_ = owner_id;
		}
	}
Пример #28
0
		public static Vector3 Serialize (BitStream stream, Vector3 vector)
		// Serialize a Vector3 to a BitStream
		{
			float x = vector.x, y = vector.y, z = vector.z;

			stream.Serialize (ref x);
			stream.Serialize (ref y);
			stream.Serialize (ref z);

			return new Vector3 (x, y, z);
		}
Пример #29
0
 void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
 {
     if (stream.isWriting) {
             float duration = remainingDuration;
             stream.Serialize (ref duration);
     } else {
             float duration = 0;
             stream.Serialize (ref duration);
             remainingDuration = duration;
     }
 }
 void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
 {
     float animTime = 0;
     if (stream.isWriting){
         animTime = animation[animations[currentAnimation]].normalizedTime;
         stream.Serialize(ref animTime);
     } else {
         stream.Serialize(ref animTime);
         animation[animations[currentAnimation]].normalizedTime = animTime;
     }
 }
Пример #31
0
    public override void SerializeNetwork(UnityEngine.BitStream stream)
    {
        float _attackingTimer = attackingTimer;

        if (stream.isWriting)
        {
            stream.Serialize(ref _attackingTimer);
        }
        else
        {
            stream.Serialize(ref _attackingTimer);
            attackingTimer = _attackingTimer;
        }
    }
Пример #32
0
    public override void SerializeNetwork(UnityEngine.BitStream stream)
    {
        float _stunTime = StunTime;

        if (stream.isWriting)
        {
            stream.Serialize(ref _stunTime);
        }
        else
        {
            stream.Serialize(ref _stunTime);
            StunTime = _stunTime;
        }
    }