private void OnUpdatePosition(ref SlimDX.Vector3 loc) { RoleActor role = mHostActor as RoleActor; if (role != null && !role.IsDie) { role.SetPosition(ref loc); if (mIsUpdate2Client == false) { return; } Int64 time = IServer.timeGetTime(); if (time - mPrevUpdateTime > 3000)//3秒钟必然同步一次 { mPrevUpdateTime = time; if (!role.HostMap.IsNullMap) { role.HostMap.RolePositionChanged(role, ref loc); mPrevPos = loc; } } else { float dist = Util.DistanceH(loc, mPrevPos); if (dist > GameSet.Instance.PosSyncDistRange) { mPrevPos = loc; if (!role.HostMap.IsNullMap) { role.HostMap.RolePositionChanged(role, ref loc); } } } } }