void SendTransform() { if ((timeLastBuffering >= bufferingPeriod)&&((lastAnimation!="idle")||(currentAnimation!="idle"))) {//&&(lastAnimation.Equals("idle")) lastState = NetworkTransform.FromTransform(thisTransform); SFSObject data=new SFSObject(); if (!currentAnimation.Equals(lastAnimation)) data.PutUtfString("anim",currentAnimation); lastState.ToSFSObject(data); buffer.AddSFSObject(data); timeLastSending += bufferingPeriod; packageSize+=1; timeLastBuffering = 0.0f; lastAnimation=currentAnimation; //return; } else if (!packageSize.Equals(0)){ sendBuffer(); packageSize=0; } if (packageSize.Equals(packageMaxSize)){ sendBuffer(); packageSize=0; //timeLastSending = 0.0f; } timeLastBuffering += Time.deltaTime; }
/// <summary> /// Send local transform to the server /// </summary> /// <param name="ntransform"> /// A <see cref="NetworkTransform"/> /// </param> public void SendTransform(NetworkTransform ntransform) { Room room = sfs.LastJoinedRoom; ISFSObject data = new SFSObject(); ntransform.ToSFSObject(data); ExtensionRequest request = new ExtensionRequest("sendTransform", data, room, true); // True flag = UDP sfs.Send(request); }
/// <summary> /// Send local transform to the server /// </summary> /// <param name="ntransform"> /// A <see cref="NetworkTransform"/> /// </param> public void SendTransform(NetworkTransform ntransform) { Room room = smartFox.LastJoinedRoom; ISFSObject data = new SFSObject(); ntransform.ToSFSObject(data); ExtensionRequest request = new ExtensionRequest("sendTransform", data, room, true); // True flag = UDP smartFox.Send(request); }
/// <summary> /// Send local transform to the server /// </summary> /// <param name="ntransform"> /// A <see cref="NetworkTransform"/> /// </param> public void SendTransform(NetworkTransform ntransform) { if (localPlayer != null) { Debug.Log("SendTransform"); ISFSObject trans = new SFSObject(); ntransform.ToSFSObject(trans); Debug.Log(smartFox.LastJoinedRoom.Name); smartFox.Send(new ExtensionRequest("control.tr", trans, smartFox.LastJoinedRoom)); } }