public void SendMove(float walkForward, float walkRight, float cameraPitch, float cameraYaw, float leftExtend, float rightExtend, bool jump, bool playDead, bool shooting) { if (host != null && host.isReady) { NetStream netStream = NetGame.BeginMessage(NetMsgId.Move); try { netStream.WriteNetId(netId); netStream.Write(NetFloat.Quantize(walkForward, 1f, 8), 8); netStream.Write(NetFloat.Quantize(walkRight, 1f, 8), 8); netStream.Write(NetFloat.Quantize(Math2d.NormalizeAngleDeg(cameraPitch), 180f, 9), 9); netStream.Write(NetFloat.Quantize(Math2d.NormalizeAngleDeg(cameraYaw), 180f, 9), 9); netStream.Write(NetFloat.Quantize(leftExtend, 1f, 5), 5); netStream.Write(NetFloat.Quantize(rightExtend, 1f, 5), 5); netStream.Write(jump); netStream.Write(playDead); netStream.Write(shooting); NetGame.instance.SendUnreliableToServer(netStream, -1); } finally { if (netStream != null) { netStream = netStream.Release(); } } } }
public override bool CheckInstantSuccess(bool playerInside) { Vector3 eulerAngles = body.rotation.eulerAngles; float z = eulerAngles.z; Vector3 eulerAngles2 = bodyStartRot.eulerAngles; return(Mathf.Abs(Math2d.NormalizeAngleDeg(z - eulerAngles2.z)) > angleDistanceSuccess); }