public static FSVector3 Input2Dir(C2SPlayerInput localInput, FSVector3 v3) { if (localInput.isUp) { Extension.Lg("/\\"); v3.SetFSVector3(0, 0, 1); } else if (localInput.isRight) { Extension.Lg(">"); v3.SetFSVector3(1, 0, 0); } else if (localInput.isLeft) { Extension.Lg("<"); v3.SetFSVector3(-1, 0, 0); } else if (localInput.isDown) { Extension.Lg("\\/"); v3.SetFSVector3(0, 0, -1); } else { v3.SetFSVector3(0, 0, 0); } return(v3); }
void PushFrameInput(C2SPlayerInput localInput, int pId) { if (!allPlayerServerFrame.ContainsKey(pId)) { Debug.Log("the allPlayerServerFrame do not contain local player id:" + playerId); return; } var lframe = allPlayerServerFrame[pId]; lframe.PushFrame(localInput); }
public void Copy(C2SPlayerInput pInput) { this.tick = pInput.tick; this.isUp = pInput.isUp; this.isDown = pInput.isDown; this.isLeft = pInput.isLeft; this.isRight = pInput.isRight; this.hashCode = 1011; this.pos = new FSVector3((int)pInput.pos.x, (int)pInput.pos.y, (int)pInput.pos.z); this.playerId = pInput.playerId; }
void SendPlayerInput() { var pInput = new C2SPlayerInput(); pInput.tick = this.localFrameTick; pInput.isUp = PlayerInputUI.isUp; pInput.isDown = PlayerInputUI.isDown; pInput.isLeft = PlayerInputUI.isLeft; pInput.isRight = PlayerInputUI.isRight; pInput.hashCode = 1011; curPlayerPos.x = curPlayer.FSyncTransform.pos.X; curPlayerPos.y = curPlayer.FSyncTransform.pos.Y; curPlayerPos.z = curPlayer.FSyncTransform.pos.Z; pInput.pos = curPlayerPos; pInput.playerId = this.playerId; PushLocalFrameInput(pInput); NetWorkManager.Instance.SendUDP(pInput); localFrameTick++; }
public void PushNewFrame(C2SPlayerInput f) { latestPtr++; frames[latestPtr % frameLength] = f; }