Exemplo n.º 1
0
    private void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info)
    {
        // Serialize the position and color
        Vector3    pos = Vector3.zero;
        Quaternion rot = Quaternion.identity;

        if (stream.isWriting)
        {
            if (isMine() == true)
            {
//				Color color = _renderer.material.color;
//				NetworkUtilities.Serialize (ref stream, ref color);

                pos = transform.position;
                rot = transform.rotation;

                NetworkUtilities.Serialize(ref stream, ref pos);
                NetworkUtilities.Serialize(ref stream, ref rot);
            }
        }
        else
        {
            if (isMine() == false)
            {
//				Color color = Color.white;
//				NetworkUtilities.Serialize (ref stream, ref color);
                NetworkUtilities.Serialize(ref stream, ref pos);
                NetworkUtilities.Serialize(ref stream, ref rot);

                correctPlayerPos = pos;
                correctPlayerRot = rot;

//				_renderer.material.color = color;
            }
        }
    }