void DecodData() { byte[] bytes = NetCommon.Decode(ref ReceiveCache); if (bytes == null) { return; } p_AllMsg p_AllMsg = new p_AllMsg(); p_AllMsg = Serialization.DeserializeData(bytes); NetCommon.HandleData(connectionID, p_AllMsg); DecodData(); }
public void OnHit(HitData hitData, bool pvp) { // setup position. Vector3 position = Vector3.zero; float rotate = 0; NetCommon.Decode(hitData.HitX, hitData.HitY, hitData.HitZ, hitData.HitDir, ref position, ref rotate); // if the pos is too large than [xxx = 1.0f] ignore this hit data // to avoid flash moving... Vector3 offset = position - mPosition; if (pvp && offset.sqrMagnitude > 1.0f) { return; } Move(offset); SetOrientation(rotate); // avoid replay action. if (hitData.HitAction != byte.MaxValue && hitData.HitAction != mActionStatus.ActiveAction.ActionCache) { mActionStatus.ChangeAction(hitData.HitAction, 0); } // setup straight time. mActionStatus.SetStraightTime(hitData.StraightTime, true); // setup lash time. if (hitData.LashTime > 0) { mActionStatus.SetLashVelocity( hitData.LashX * 0.01f, hitData.LashY * 0.01f, hitData.LashZ * 0.01f, hitData.LashTime); } }