private static byte[] Byte_ConvertObjectToBinary_FromMulti1Pos(Multi1Pos obj) { MemoryStream o = new MemoryStream(); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(o, obj); return o.GetBuffer(); }
public void OnRealTimeMessageReceived(bool isReliable, string senderId, byte[] data) { //Position = Byte_ReadFromBinary(data); //MultiPos = Byte_ReadFromBinary_ToMulti1Pos (data); //Debug.Log ("Update X Position received: "+MultiPos.Multi1PosX); //Debug.Log ("Update Y Position received: "+MultiPos.Multi1PosY); MultiPos = Byte_ReadFromBinary_ToMulti1Pos (data); if (MultiPos.Name.Equals ("YPosition")) { Position = MultiPos.Multi1PosY; } Debug.Log ("Position received: " + Position); Debug.Log("Versus Listener: Callback - " + System.Reflection.MethodBase.GetCurrentMethod().Name + " called"); }
void FixedUpdate () { //aux = new Multi1Pos (dizzyBirdObj.transform.position.x, // dizzyBirdObj.transform.position.y, // dizzyBirdObj.transform.rotation.z); //PosToSend = Byte_ConvertObjectToBinary (aux); //MultiPos = new Multi1Pos (dizzyBirdObj.transform.position.x, // dizzyBirdObj.transform.position.y, // dizzyBirdObj.transform.rotation.z); //PosToSend = Byte_ConvertObjectToBinary_FromMulti1Pos (MultiPos); //PosToSend = Byte_ConvertObjectToBinary (dizzyBirdObj.transform.position.y); //PosToSend = Byte_ConvertObjectToBinary (dizzyBirdObj.transform.position.y); dizzy1Pos = new Multi1Pos ("YPosition", dizzyBirdObj.transform.position.x, dizzyBirdObj.transform.position.y); PosToSend = Byte_ConvertObjectToBinary_FromMulti1Pos (dizzy1Pos); PlayGamesPlatform.Instance.RealTime.SendMessageToAll(false, PosToSend); //dizzyBirdObjMulti.transform.position = new Vector3 (dizzyBirdObjMulti.transform.position.x, // vsListener.Position, // dizzyBirdObjMulti.transform.position.z); }