Exemplo n.º 1
0
        internal void HandleSetMovement(SquarePoint point, RoomUser user)
        {
            int nextX = point.X;
            int nextY = point.Y;

            user.RemoveStatus("mv");
            double nextZ = GameMap.SqAbsoluteHeight(nextX, nextY);

            user.RemoveStatus("lay");
            user.RemoveStatus("sit");

            user.AddStatus("mv", nextX + "," + nextY + "," + Misc.TextHandling.GetString(nextZ));
            int newRot = GameMap.CalculateRotation(user.X, user.Y, nextX, nextY);

            user.Rot = newRot;

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

            GameMap.Map[user.X, user.Y]       = user.CurrentSqState;
            user.CurrentSqState               = GameMap.Map[user.SetX, user.SetY];
            GameMap.Map[user.SetX, user.SetY] = SqState.Closed;


            user.NeedsUpdate = true;
        }
Exemplo n.º 2
0
        private void CalculatePath(RoomUser player)
        {
            SquarePoint point = DreamPathfinder.GetNextStep(player.X, player.Y, player.TargetX, player.TargetY, GameMap.Map, GameMap.ItemHeightMap, Model.MaxX, Model.MaxY, false, GameMap.DiagonalEnabled);

            if (point.X == player.X && point.Y == player.Y) //No path found, or reached goal (:
            {
                player.IsWalking = false;
                player.RemoveStatus("mv");
            }
            else
            {
                HandleSetMovement(point, player);
            }
            player.NeedsUpdate = true;
        }