예제 #1
0
        protected override void OnUpdateRoationY(float angle)
        {
            base.OnUpdateRoationY(angle);
            RoleActor role = mHostActor as RoleActor;

            if (role != null)
            {
                role.SetDir(angle);
            }

            if (mIsUpdate2Client == false)
            {
                return;
            }

            Int64 time = IServer.timeGetTime();

            if (time - mPrevUpdateTime > 3000)//3秒钟必然同步一次
            {
                mPrevUpdateTime = time;
                if (!role.HostMap.IsNullMap)
                {
                    role.HostMap.RoleDirectionChanged(role, angle);
                }
            }
            else
            {
                float dist = System.Math.Abs(mPrevAngle - angle);
                if (dist > System.Math.PI * 5 / 180)
                {
                    mPrevAngle = angle;

                    if (!role.HostMap.IsNullMap)
                    {
                        role.HostMap.RoleDirectionChanged(role, angle);
                    }
                }
            }
        }