当前位置: 首页>>代码示例>>C#>>正文


C# RoomUser.UserIsRidingAHorse方法代码示例

本文整理汇总了C#中RoomUser.UserIsRidingAHorse方法的典型用法代码示例。如果您正苦于以下问题:C# RoomUser.UserIsRidingAHorse方法的具体用法?C# RoomUser.UserIsRidingAHorse怎么用?C# RoomUser.UserIsRidingAHorse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RoomUser的用法示例。


在下文中一共展示了RoomUser.UserIsRidingAHorse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateUserStatus

        internal void UpdateUserStatus(RoomUser User, bool cyclegameitems)
        {
            if (User == null)
                return;
            bool isBot = User.IsBot;
            if (isBot)
                cyclegameitems = false;

            if (User.Statusses.ContainsKey("lay") || User.Statusses.ContainsKey("sit"))
            {
                User.Statusses.Remove("lay");
                if (!User.forcesit)
                    User.Statusses.Remove("sit");
                User.UpdateNeeded = true;
            }

            //List<RoomItem> ItemsOnSquare = GetFurniObjects(User.X, User.Y);
            //CoordItemSearch ItemSearch = new CoordItemSearch(room.GetGameMap().CoordinatedItems);
			int userCoord = User.GetDoubleCoordinate();
			List<RoomItem> ItemsOnSquare = room.GetGameMap().GetCoordinatedItems(ref userCoord); //ItemSearch.GetAllRoomItemForSquare(User.X, User.Y);
            double newZ = room.GetGameMap().GetNewZForUser(User.X, User.Y, User.Z);
            
            if (newZ != User.Z)
            {
                if (User.isFlying)
                    newZ += 4 + (0.5 * Math.Sin(0.7 * User.flyk));
                if (User.UserIsRidingAHorse())
                    newZ += 1;

                User.Z = newZ;
                User.UpdateNeeded = true;
            }

            DynamicRoomModel Model = room.GetGameMap().Model;
            if (Model.SqState[User.X, User.Y] == SquareState.SEAT)
            {
                if (!User.Statusses.ContainsKey("sit"))
                {
                    User.Statusses.Add("sit", "1.0");
                }

                User.Z = Model.SqFloorHeight[User.X, User.Y];
                if (User.isFlying)
                    User.Z += 4 + (0.5 * Math.Sin(0.7 * User.flyk));
                User.RotHead = Model.SqSeatRot[User.X, User.Y];
                User.RotBody = Model.SqSeatRot[User.X, User.Y];

                User.UpdateNeeded = true;
			}

            RoomItem[] items = room.GetGameMap().GetCoordinatedHeighestItems(ref userCoord).ToArray();

            foreach (RoomItem item in items)
                item.OnUserWalk(User, cyclegameitems);

            if (User.pressurePlate != 0)
            {
                if (User.PressurePlateReset)
                {
                    RoomItem plate = room.GetRoomItemHandler().GetItem(User.pressurePlate);

                    if (plate == null)
                        return;

                    User.pressurePlate = 0;

                    plate.ExtraData = "0";
                    plate.UpdateState(false, true);
                }

                User.PressurePlateReset = true;
            }

			if (cyclegameitems)
            {
                if (room.GotSoccer())
                    room.GetSoccer().OnUserWalk(User);

                if (room.GotBanzai())
                    room.GetBanzai().OnUserWalk(User);

                if (room.GotFreeze())
                    room.GetFreeze().OnUserWalk(User);
			}
		}
开发者ID:BjkGkh,项目名称:R106,代码行数:85,代码来源:RoomUserManager.cs

示例2: HandleSetMovement

        private void HandleSetMovement(SquarePoint Point, RoomUser User, ref bool updated, bool setSquareMap)
        {
            int nextX = Point.X;
            int nextY = Point.Y;

            User.RemoveStatus("mv");

            //double nextZ = room.GetGameMap().SqAbsoluteHeight(nextX, nextY);
            double nextZ = room.GetGameMap().GetNewZForUser(nextX, nextY, User.Z);

            //if (room.GetGameMap().SquareOccupied(nextX, nextY, nextZ))
            //    return;

            if (User.UserIsRidingAHorse())
                nextZ += 1;

            User.Statusses.Remove("lay");
            User.Statusses.Remove("sit");
            if (!User.isFlying)
                User.AddStatus("mv", nextX + "," + nextY + "," + TextHandling.GetString(nextZ));
            else
                User.AddStatus("mv", nextX + "," + nextY + "," + TextHandling.GetString(nextZ + 4 + (0.5 * Math.Sin(0.7 * User.flyk))));

            int newRot = Rotation.Calculate(User.X, User.Y, nextX, nextY, User.moonwalkEnabled);

            User.RotBody = newRot;
            User.RotHead = newRot;

            User.SetStep = true;
            User.SetX = nextX;
            User.SetY = nextY;
            User.SetZ = nextZ;

            UpdateUserEffect(User, User.SetX, User.SetY);
            updated = true;
            User.UpdateNeeded = true;


            if (setSquareMap)
            {
                room.GetGameMap().GameMap[User.X, User.Y] = User.SqState; // REstore the old one
                User.SqState = room.GetGameMap().GameMap[User.SetX, User.SetY];//Backup the new one
                
                if (!room.AllowWalkthrough)
                    room.GetGameMap().GameMap[nextX, nextY] = 0;
            }
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:47,代码来源:RoomUserManager.cs


注:本文中的RoomUser.UserIsRidingAHorse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。